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:
parent
6452f6295e
commit
83893aa122
1 changed files with 5 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue