Skip to content

Allow duplicate jobs to be discarded #586

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mhenrixon
Copy link

Should resolve #176

I want to prevent the following:

CleanShot 2025-06-25 at 09 26 15@2x

These jobs can under no circumstances end up in this situation, discarding the new jobs instead of queuing them ensures this won't happen.

I took the simplest possible approach using terminology from sidekiq-unique-jobs. All feedback appreciated.

@rosa
Copy link
Member

rosa commented Jun 25, 2025

Hey @mhenrixon, thanks for this! There was already a PR for it: #523
But this idea of marking the job as finished is really clever! It'd allow for quite a few simplifications 🤔 I wonder if it's too clever, though.... would it lead to confusing scenarios where you don't know what happened to a job? Although I guess the same is true if the job is simply discarded, so this should be ok!

I need to review what happens here for the bulk enqueue case, which was the tricky part of that other PR.

@mhenrixon mhenrixon force-pushed the discard-duplicate-jobs branch from 657cdab to 4e3c7f2 Compare June 25, 2025 06:59
@mhenrixon
Copy link
Author

mhenrixon commented Jun 25, 2025

Hey @mhenrixon, thanks for this! There was already a PR for it: #523

I need to learn to read all the issues. Sorry about the extra PR.

But this idea of marking the job as finished is really clever! It'd allow for quite a few simplifications 🤔 I wonder if it's too clever, though.... would it lead to confusing scenarios where you don't know what happened to a job? Although I guess the same is true if the job is simply discarded, so this should be ok!

After working on sidekiq-unique-jobs, and with sidekiq. I have learned that some visibility is appreciated. One of the reasons to use a database-backed queue system is to maintain visibility and avoid paying a blackmailer for keeping the data safe.

I am happy to close this if you prefer the other one @rosa. I didn't look into the other PR in detail, but the bulk enqueue sounds important.

@rosa
Copy link
Member

rosa commented Jun 25, 2025

Oh, no worries! I think the idea here is better than what we were trying to do in the other PR, so I think combining these two would be the best! I need to review the other one again after some changes so I'll review these two together and will think how to proceed, maybe transplanting some commits over 🤔

@mhenrixon
Copy link
Author

Feel free to add commits or let me know what to pick or how I can help land this in the main branch. I am at your service!

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

Successfully merging this pull request may close these issues.

Discard duplicate jobs
2 participants