-
-
Notifications
You must be signed in to change notification settings - Fork 460
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
[Feature]Prevent duplicate Task in the queue #52
Comments
@flotho The logic whether a job should be created or not depending if another job exists or not changes from job to job. At best we could add a way for devs to provide a function attached to the job, that would define this logic. Keep in mind that jobs should be idempotent, and in some cases they can leave early if the work has been done already. I know this is not the same thing, but it works well enough usually in the use cases I had to implement. Anyway you have to take that in account because you could only merge "pending" "enqueued" or "started" jobs, so a identical job may already have been executed. On one side you lose some time executing a job that's already be done, on the other side, you slow down the creation of the job with extra checks. I prefer a fast delaying of jobs in the users transactions at the cost of a slower execution of those jobs in the background. Do you have examples where you would really benefit from this feature? If yes, I'd welcome a pull request implementing a smart solution, which keep the current behavior by default, but allow a developer to define merge conditions for pending jobs. |
Hi @guewen , Great thanks for this answer. Actually I understand your point of view that create fast and deliver fast will be the best. |
Closed by #66 |
Hi,
From time to time, jobs with the same Task signature are created by different methods.
This cause the queue to increase in an useless way.
Won't it be a good idea to prevent to create jobs if another one is existing in either 'pending' or 'started' state?
@guewen , what's your point of view on this one?
regards
The text was updated successfully, but these errors were encountered: