1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

fixup to poll_interval logic, so calling poll_interval= has expected behavior

This commit is contained in:
Evan Prothro 2014-08-01 14:56:51 -05:00
parent 6452f6295e
commit 83893aa122

View file

@ -51,7 +51,10 @@ module Sidekiq
logger.error ex.backtrace.first
end
after(poll_interval * rand) { poll }
# Randomizing scales the interval by half since
# on average calling `rand` returns 0.5.
# We make up for this by doubling the interval
after(poll_interval * 2 * rand) { poll }
end
end
@ -73,7 +76,7 @@ module Sidekiq
def poll_interval
Sidekiq.options[:poll_interval] ||= begin
pcount = Sidekiq.redis {|c| c.scard('processes') } || 1
pcount * 15 * 2
pcount * 15
end
end