-
-
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
Is it possible to have a :until_executed lock with an expiration time? #524
Comments
I suppose one workaround would be to use |
I've also been thinking about that rare scenario where the processes crashes and the lock lasts forever. I think The trade-off is that |
@mhenrixon I am looking into utilizing this gem and am wondering the same thing. Currently I'm trying out |
@summera, someone did find a rare race condition there. v7 is regardless of that a much more reliable If you have a look at the comment #553 (comment), #553 (comment) and think about that Shopify uses v7 beta you perhaps have a little more convincing for why v7 makes sense to upgrade to. |
Hey @mhenrixon, thanks for the response 👍 . Sounds good, I'll give |
@summera I'll revisit this topic before releasing V7. It does seem like a good idea to be able to provide an expiration for all locks starting from when they are scheduled. I think I already have a calculation that takes the time in future into consideration so I see no harm in that. Might be an option to enforce expiration unless the reaper is running. First I will have to fix that race condition somehow though. |
@summera @gchan @ravicious v7 supports expiration on all locks. Meaning they will expire starting from the time the job is pushed to the queue. If they are scheduled in the future, they will expire after that timestamp. If the job is scheduled to be executed The first of January 2022 at 10am sharp. With a |
@mhenrixon thanks a lot, working on v7 👍 . |
As other people reported here, I have an issue where unexpectedly shutting down Sidekiq when a unique job is running results in the lock being left in Redis until I clean it manually. I'm using sidekiq-unique-jobs v6.0.22.
As Redis docs say:
And then Sidekiq wiki doubles down on that:
So I'd like to have the lock get removed either when the worker finishes (like with
:until_executed
) or when a certain amount of time passes. In extreme cases, running the same job twice is acceptable for me and preferrable over the system not being able to recover from shutdown without manual intervention.However, just from reading README I cannot tell how or if achieving that with sidekiq-unique-jobs is possible? I also read issues mentioned in #362, but couldn't come up with anything. The Locking & Unlocking wiki page also suggest that it's impossible to achieve with sidekiq-unique-jobs.
The text was updated successfully, but these errors were encountered: