README.md in sidekiq-unique-jobs-7.0.0.beta26 vs README.md in sidekiq-unique-jobs-7.0.0.beta27
- old
+ new
@@ -534,11 +534,11 @@
```ruby
class UniqueJobWithFilterMethod
include Sidekiq::Worker
sidekiq_options lock: :until_and_while_executing,
- lock_args: :lock_args # this is default and will be used if such a method is defined
+ lock_args_method: :lock_args # this is default and will be used if such a method is defined
def self.lock_args(args)
[ args[0], args[2][:type] ]
end
@@ -547,11 +547,11 @@
end
class UniqueJobWithFilterProc
include Sidekiq::Worker
sidekiq_options lock: :until_executed,
- lock_args: ->(args) { [ args.first ] }
+ lock_args_method: ->(args) { [ args.first ] }
...
end
```
@@ -559,11 +559,11 @@
It is possible to ensure different types of unique args based on context. I can't vouch for the below example but see [#203](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/203) for the discussion.
```ruby
class UniqueJobWithFilterMethod
include Sidekiq::Worker
- sidekiq_options lock: :until_and_while_executing, lock_args: :lock_args
+ sidekiq_options lock: :until_and_while_executing, lock_args_method: :lock_args
def self.lock_args(args)
if Sidekiq::ProcessSet.new.size > 1
# sidekiq runtime; uniqueness for the object (first arg)
args.first
@@ -620,22 +620,22 @@
For sidekiq versions before 5.1 a `sidekiq_retries_exhausted` block is required per worker class. This is deprecated in Sidekiq 6.0
```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
```
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
```
### Other Sidekiq gems