Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
moofkit committed Jun 3, 2024
1 parent 7906cd0 commit 8f728c2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,26 +81,28 @@ class MyJob
include Sidekiq::Job
include Sidekiq::Rescue::Dsl

sidekiq_rescue ExpectedError, delay: 60, limit: 5
sidekiq_rescue ExpectedError, delay: 60, limit: 5, jitter: 0.15

def perform(*)
# ...
end
end
```

The `delay` is not the exact time between retries, but a minimum delay. The actual delay calculates based on retries counter and `delay` value. The formula is `delay + retries * rand(10)` seconds. Randomization is used to avoid retry storms.
The `delay` is not the exact time between retries, but a minimum delay. The actual delay calculates based on jitter and `delay` value. The formula is `delay + delay * jitter * rand` seconds. Randomization is used to avoid retry storms. The `jitter` represents the upper bound of possible wait time (expressed as a percentage) and defaults to 0.15 (15%).

The default values are:
- `delay`: 60 seconds
- `limit`: 5 retries
- `jitter`: 0.15

Delay and limit can be configured globally:
Delay, limit and jitter can be configured globally:

```ruby
Sidekiq::Rescue.configure do |config|
config.delay = 65
config.limit = 10
config.jitter = 0.2
end
```

Expand Down

0 comments on commit 8f728c2

Please sign in to comment.