Created
April 14, 2015 14:00
-
-
Save trak3r/a9ed9ebad1db0696406a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Delayed | |
class Worker | |
class << self | |
def sleep_delay_with_fudging | |
# stagger sleeps by +/- 10% so all the workers don't spike at same time | |
sleep_delay_without_fudging * rand(0.9..1.1) | |
end | |
alias_method_chain :sleep_delay, :fudging | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment