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

Don't repeat periodic task till its completed by other workers #262

Open
bhaskar8088 opened this issue Apr 29, 2021 · 0 comments
Open

Don't repeat periodic task till its completed by other workers #262

bhaskar8088 opened this issue Apr 29, 2021 · 0 comments

Comments

@bhaskar8088
Copy link

bhaskar8088 commented Apr 29, 2021

I think a periodic task should not repeat till current job is completed. But other workers are starting the task even when job is not yet completed in another worker.

Example scenario:

Lets say I want to write a periodic task that makes payments every 60 seconds to users who requested withdraw. Lets say it took 2 min to do some process but payments not yet made so those payment requests are still in pending. But if another worker picks up before other one completes it (or marks payment request as done), then payments will go twice.

So, is there any existing solution here? Or do I need to customise it somehow?

Possible solutions:

Inside the task being executed, loop over all workers and check if the job related to that task is current job of any worker? If yes, just return it so it can run in next schedule.

But I think it will be better to have this feature. If possible, please add it.

Thanks

@bhaskar8088 bhaskar8088 changed the title Don't repeat periodic task till its completed Don't repeat periodic task till its completed by other workers Apr 29, 2021
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

No branches or pull requests

1 participant