Skip to content

Commit

Permalink
Hack to speed up the test suite just a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Jan 6, 2016
1 parent bf70844 commit bf9ba44
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/sidekiq/manager.rb
Expand Up @@ -55,21 +55,23 @@ def quiet
fire_event(:quiet, true)
end

PAUSE_TIME = $TESTING ? 0.1 : 0.5

def stop(deadline)
quiet
fire_event(:shutdown, true)

# some of the shutdown events can be async,
# we don't have any way to know when they're done but
# give them a little time to take effect
sleep 0.5
sleep PAUSE_TIME
return if @workers.empty?

logger.info { "Pausing to allow workers to finish..." }
remaining = deadline - Time.now
while remaining > 0.5
while remaining > PAUSE_TIME
return if @workers.empty?
sleep 0.5
sleep PAUSE_TIME
remaining = deadline - Time.now
end
return if @workers.empty?
Expand Down

0 comments on commit bf9ba44

Please sign in to comment.