Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
1. `unique_digest` is now named `lock_digest`
2. `delete_by_digest` is an instance method

Also fixes the cleanup of digests to use the `delete_by_pattern` method.
  • Loading branch information
mhenrixon committed Nov 2, 2020
1 parent da9e50c commit cffe931
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,8 @@ For sidekiq versions before 5.1 a `sidekiq_retries_exhausted` block is required
```ruby
class MyWorker
sidekiq_retries_exhausted do |msg, _ex|
digest = msg['unique_digest']
SidekiqUniqueJobs::Digests.delete_by_digest(digest) if digest
digest = msg['lock_digest']
SidekiqUniqueJobs::Digests.new.delete_by_digest(digest) if digest
end
end
```
Expand All @@ -633,8 +633,8 @@ Starting in v5.1, Sidekiq can also fire a global callback when a job dies:
```ruby
Sidekiq.configure_server do |config|
config.death_handlers << ->(job, _ex) do
digest = job['unique_digest']
SidekiqUniqueJobs::Digests.delete_by_digest(digest) if digest
digest = job['lock_digest']
SidekiqUniqueJobs::Digests.new.delete_by_digest(digest) if digest
end
end
```
Expand Down
3 changes: 2 additions & 1 deletion lib/sidekiq_unique_jobs/testing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def sidekiq_options(options = {})
#
def clear_all
super
SidekiqUniqueJobs::Digests.new.del(pattern: "*", count: 1_000)

SidekiqUniqueJobs::Digests.new.delete_by_pattern("*", count: 10_000)
end
end

Expand Down

0 comments on commit cffe931

Please sign in to comment.