Skip to content
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

New feature: Replace original job if duplicate is added #177

Closed
mmustala opened this issue Mar 29, 2016 · 2 comments
Closed

New feature: Replace original job if duplicate is added #177

mmustala opened this issue Mar 29, 2016 · 2 comments

Comments

@mmustala
Copy link

Hi,

I'm having a situation where I would like to replace the original job when a new job with similar parameters is added to the queue.

In my app I'm using RecordWorker to update records in background jobs, one job per record. When all records have been updated AnotherWorker should start processing the data. Currently I'm having each background job calling AnotherWorker.perform_in(1.hour, params), and the AnotherWorker uses unique: :until_executing. I'm practically hoping that all records have been updated within one hour.

Instead of this, when a new AnotherWorker job is put into the queue I would like to remove the previous job. Then I would be sure that the AnotherWorker starts one hour after the last record is updated.

Would something like this be possible to do? Or do you know that something is preventing this kind of functionality?

@mhenrixon
Copy link
Owner

This has been requested before. While I'm not sure how to make this absolutely reliable I will take it under consideration for the next version.

@jakecraige
Copy link

👋 This would be a great feature to have if it's still up for consideration. We currently have our queue getting a lot of duplicate jobs as a result of the TTL strategy, and don't want to increase it too high to prevent faster retries, so replacing the job with a new one would be a nice middle ground.

In the meantime we'll just bump the lock_expiration up though 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants