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

Schedule tasks x timeunits after previous task has finished #65

Closed
mr-flannery opened this issue Feb 11, 2020 · 1 comment
Closed

Schedule tasks x timeunits after previous task has finished #65

mr-flannery opened this issue Feb 11, 2020 · 1 comment

Comments

@mr-flannery
Copy link

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

From my understanding of the docs, there are currently three styles of scheduling supported: cron, interval and timeout-once.
None of them are what I would like to do, which is...

Expected behavior

...interval after last task finished. Essentially something like "run a new task 10 seconds after the previous task has finished".

What is the motivation / use case for changing the behavior?

For example, I have a task that should regularly poll something, let's say every ten seconds.
In these ten seconds, there could be very few or a lot of new things that I'm polling. If there are lots of new things that I need to process, this might take longer than the specified timeout. Ideally, I'd like to prevent my task from starting while the previous task is still running.

@kamilmysliwiec
Copy link
Member

You should use dynamic intervals/timeouts/cron jobs for that https://docs.nestjs.com/techniques/task-scheduling#dynamic-intervals

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

2 participants