-
-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 5&6: uniqueness not respected for Job without params #349
Comments
Added a parameter, and called the job with a single value param
the jobs seems to be allowed to run twice at the time still
|
switch the lock type to class DupTestJob
include Sidekiq::Worker
sidekiq_options retry: false, backtrace: true, unique: :until_executing, on_conflict: :log
def perform # (foo)
t = Time.now
Sidekiq.logger.info("DupTestJob started: #{t}")
sleep(180)
Sidekiq.logger.info("DupTestJob done: #{Time.now - t}")
end
#def self.unique_args(args)
# "8914bee5-b06e-407d-80ab-0a5748a2aab4" # whatever
#end
end
it ran concurrently as many time as I ran it... |
I tried adding the unique_args method call back and a lock expiration. jobs still runs in parallel class DupTestJob
include Sidekiq::Worker
sidekiq_options retry: false, backtrace: true, lock_expiration: 10.minutes,
unique: :until_and_while_executing,
unique_args: :unique_args, on_conflict: :log
def perform
t = Time.now
Sidekiq.logger.info("DupTestJob started: #{t}")
sleep(180)
Sidekiq.logger.info("DupTestJob done: #{Time.now - t}")
end
def self.unique_args(args)
"8914bee5-b06e-407d-80ab-0a5748a2aab4" # whatever
end
end looks like the lock holds for 1minute, then 2nd job starts, I can't queue 3rd right away, but about 90 seconds after scheduling the first two, I can schedule one more, which will start exactly 2 minutes after the first one |
for the sake of completeness it behaves as expected with 6.0.6, but we're afraid to hit that problem described in #332 |
confirmed, perform without params or unique_args callback will ignore unique lock class DupTestJob
include Sidekiq::Worker
sidekiq_options retry: 0, backtrace: true,
#lock_expiration: 10.minutes,
unique: :until_executing,
# unique_args: :unique_args,
on_conflict: :log
def perform
t = Time.now
Sidekiq.logger.info("DupTestJob started: #{t}")
sleep(180)
Sidekiq.logger.info("DupTestJob done: #{Time.now - t}")
end
#def self.unique_args(args)
# "8914bee5-b06e-407d-80ab-0a5748a2aab4" # whatever
#end
end runs as many jobs in parallel as I scheduled them |
problem is caused by run lock timeout, which we can override class DupTestJob
include Sidekiq::Worker
sidekiq_options retry: 0, backtrace: true,
unique: :until_and_while_executing,
run_lock_expiration: 5.minutes.to_i
def perform
t = Time.now
Sidekiq.logger.info("DupTestJob started: #{t}")
sleep(180)
Sidekiq.logger.info("DupTestJob done: #{Time.now - t}")
end
end WORKS_FOR_ME |
Describe the bug
We just found out a job without any params would be allowed to run concurrently
although we have the following options enabled
Expected behavior
jobs without argument with unique constraint should not run concurrently
Current behavior
we had jobs running concurrently
Worker class
Additional context
I will try to come up with a better example to reproduce
The text was updated successfully, but these errors were encountered: