-
-
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
lock: :until_and_while_executing not working for scheduled jobs #334
Comments
I seem to have the same problem but with until_executed. I'm running version 6.0.6 of the gem and have created a test job like this: class TestUniqJob < SidekiqJob
sidekiq_options queue: :default, retry: false, unique: :until_executed
def perform
sleep 3.minutes
end
end I use the whenever gem to plan to run this every 2 minutes, however, it should only queue or run this is it's not already queued or running. Unfortunately it doesn't seem to do anything to prevent the double execution:
|
Anyone find a solution to this? |
@rept might be a stupid question but... Did you setup the middleware? Also what is in the class Edit: I tried your code and I can't replicate the problem with it. In the rails console I do the following: [2] pry(main)> 10.times { p TestUniqJob.perform_async }
"ed75904f197510f8cae53606"
nil
nil
nil
nil
nil
nil
nil
nil
nil
=> 10 The sidekiq server process logs the following:
Only one job starts and it runs for 3 minutes. |
@macmartine I can't replicate the problem for your example either: SequenceActionWorker.perform_at(Time.now + 5.minutes, 1)
=> "ece62bec44a2769af68cbd5b"
SequenceActionWorker.perform_at(Time.now + 5.minutes, 1)
=> nil
SequenceActionWorker.perform_at(Time.now + 5.minutes, 1)
=> nil
SequenceActionWorker.perform_at(Time.now + 5.minutes, 2)
=> "d34950d4b74ea9e1550a21cd"
SequenceActionWorker.perform_at(Time.now + 5.minutes, 3)
=> "629bf13bab02e6aa36fa1e4e"
SequenceActionWorker.perform_at(Time.now + 5.minutes, 4)
=> "96a10e00f7dd5133da38bf0d"
SequenceActionWorker.perform_at(Time.now + 5.minutes, 4)
=> nil
SequenceActionWorker.perform_at(Time.now + 5.minutes, 4)
=> nil
SequenceActionWorker.perform_async(1)
=> nil
SequenceActionWorker.perform_async(4)
=> nil Looks like everything is working fine to me... Much later in the sidekiq logs...
|
@gommo happy to have a look at your problem too but you need to provide something to go on otherwise I am closing this issue. |
@rept why do you have there Was just implementing uniq lock for scheduled jobs and this works fine for me. |
Closing due to inactivity. I requested more information and didn't get a reply. |
Describe the bug
Duplicate jobs are getting run when scheduling jobs using perform_at
Expected behavior
When a job is scheduled to be run in the future, and a job with the same arguments gets called, it shouldn't be added to the schedule.
Current behavior
Duplicate jobs are added and run.
Worker class
The jobs are getting executed with:
The text was updated successfully, but these errors were encountered: