Skip to content

Commit

Permalink
Remove 10 second wait in Poller if the poll interval is already set, …
Browse files Browse the repository at this point in the history
…since there's no reason to wait for the heartbeats.
  • Loading branch information
jonhyman committed Jan 27, 2015
1 parent 67dc667 commit 70e61db
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/sidekiq/scheduled.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ def poll_interval

def initial_wait
begin
# Have all processes sleep between 10-15 seconds. 10 seconds
# to give time for the heartbeat to register and 5 random seconds
# to ensure they don't all hit Redis at the same time.
sleep(INITIAL_WAIT)
# Have all processes sleep between 5-15 seconds. 10 seconds
# to give time for the heartbeat to register (if the poll interval is going to be calculated by the number
# of workers), and 5 random seconds to ensure they don't all hit Redis at the same time.
sleep(INITIAL_WAIT) unless Sidekiq.options[:poll_interval]
sleep(5 * rand)
rescue Celluloid::Task::TerminatedError
# Hit Ctrl-C when Sidekiq is finished booting and we have a chance
Expand Down

0 comments on commit 70e61db

Please sign in to comment.