You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The self.lock_args class method is never called when the lock_args parameter is defined in the sidekiq_options method.
Expected behavior
The self.lock_args class method should be called when it is defined in the sidekiq_options lock_args: :lock_args. Or the documentation should be updated to reflect this behaviour. Conversely, unique_args works when it is defined in the class and sidekiq_options unique_args: :unique_args. So there should be some consistency there.
Current behavior
Currently, the self.lock_args is never called when it is defined in the lock_args parameter.
Worker class
# this example does not work self.lock_args is never calledclassUniqueJobWithFilterMethodincludeSidekiq::Workersidekiq_optionslock: :until_and_while_executing,lock_args: :lock_argsdefself.lock_args(args)[args[0],args[2][:type]]end
...
end
# this example works by not defining the lock_args parameter and using default class function self.lock_args.classUniqueJobWithFilterMethodincludeSidekiq::Workersidekiq_optionslock: :until_and_while_executingdefself.lock_args(args)[args[0],args[2][:type]]end
...
end
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
You must only define the lock_args argument to the sidekiq options if you need to deviate from the default convention. That said, I can see why someone might want to be explicit about it.
That makes sense. However, I took the failing example copy pasted exactly from the documentation. So it is a little confusing on what the correct definition would be.
Great find! This will require some additional changes:
Instead of sidekiq_options lock_args: :lock_args you need to set it to sidekiq_options lock_args_method: :lock_args. Unfortunately, the usage of this key skipped the writing of the arguments completely so every single job where attempted to be set with the unique argument :lock_args.
I won't release it just yet, I need to write some better coverage for this tomorrow. I want to also backport this to v6.
Version:
7.0.0.beta25
Describe the bug
The self.lock_args class method is never called when the lock_args parameter is defined in the sidekiq_options method.
Expected behavior
The self.lock_args class method should be called when it is defined in the sidekiq_options lock_args: :lock_args. Or the documentation should be updated to reflect this behaviour. Conversely, unique_args works when it is defined in the class and sidekiq_options unique_args: :unique_args. So there should be some consistency there.
Current behavior
Currently, the self.lock_args is never called when it is defined in the lock_args parameter.
Worker class
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: