Last active
April 19, 2023 15:31
-
-
Save padde/5037fd9b86ba8710c0caf35d4ce86dc7 to your computer and use it in GitHub Desktop.
Sidekiq retry schedule
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
require 'active_support/duration' | |
offset = 0 | |
puts "attempt 0 immediately" | |
0.upto(24) do |count| | |
# https://github.com/mperham/sidekiq/blob/v6.1.2/lib/sidekiq/job_retry.rb#L225 | |
average_jitter = (15 * (count + 1)) | |
delay = count**4 + 15 + average_jitter | |
offset += delay | |
puts "attempt #{count + 1} after #{ActiveSupport::Duration.build(offset).inspect} (± #{ActiveSupport::Duration.build(average_jitter).inspect})" | |
end |
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
attempt 0 immediately | |
attempt 1 after 30 seconds (± 15 seconds) | |
attempt 2 after 1 minute and 16 seconds (± 30 seconds) | |
attempt 3 after 2 minutes and 32 seconds (± 45 seconds) | |
attempt 4 after 5 minutes and 8 seconds (± 1 minute) | |
attempt 5 after 10 minutes and 54 seconds (± 1 minute and 15 seconds) | |
attempt 6 after 23 minutes and 4 seconds (± 1 minute and 30 seconds) | |
attempt 7 after 46 minutes and 40 seconds (± 1 minute and 45 seconds) | |
attempt 8 after 1 hour, 28 minutes, and 56 seconds (± 2 minutes) | |
attempt 9 after 2 hours, 39 minutes, and 42 seconds (± 2 minutes and 15 seconds) | |
attempt 10 after 4 hours, 31 minutes, and 48 seconds (± 2 minutes and 30 seconds) | |
attempt 11 after 7 hours, 21 minutes, and 28 seconds (± 2 minutes and 45 seconds) | |
attempt 12 after 11 hours, 28 minutes, and 44 seconds (± 3 minutes) | |
attempt 13 after 17 hours, 17 minutes, and 50 seconds (± 3 minutes and 15 seconds) | |
attempt 14 after 1 day, 1 hour, 17 minutes, and 36 seconds (± 3 minutes and 30 seconds) | |
attempt 15 after 1 day, 12 hours, 1 minute, and 52 seconds (± 3 minutes and 45 seconds) | |
attempt 16 after 2 days, 2 hours, 9 minutes, and 52 seconds (± 4 minutes) | |
attempt 17 after 2 days, 20 hours, 26 minutes, and 38 seconds (± 4 minutes and 15 seconds) | |
attempt 18 after 3 days, 19 hours, 43 minutes, and 24 seconds (± 4 minutes and 30 seconds) | |
attempt 19 after 5 days and 58 minutes (± 4 minutes and 45 seconds) | |
attempt 20 after 6 days, 13 hours, 15 minutes, and 16 seconds (± 5 minutes) | |
attempt 21 after 1 week, 1 day, 9 hours, 47 minutes, and 26 seconds (± 5 minutes and 15 seconds) | |
attempt 22 after 1 week, 3 days, 15 hours, 54 minutes, and 32 seconds (± 5 minutes and 30 seconds) | |
attempt 23 after 1 week, 6 days, 9 hours, 4 minutes, and 48 seconds (± 5 minutes and 45 seconds) | |
attempt 24 after 2 weeks, 2 days, 14 hours, 55 minutes, and 4 seconds (± 6 minutes) | |
attempt 25 after 2 weeks, 6 days, 11 hours, 11 minutes, and 10 seconds (± 6 minutes and 15 seconds) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment