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

Loop with dynamic interval #48

Merged
merged 1 commit into from
Nov 20, 2024
Merged

Conversation

jpuh
Copy link
Contributor

@jpuh jpuh commented Oct 29, 2024

In some cases it might be desirable to control when the next loop runs, for instance:

  • sooner because there's work to do, like pending tasks that could be processed;
  • later because in some periods there's no need to run often.

To address these cases, this PR takes into account the loop callback return value:

  • if the callback returns an object with interval key then it is used for the next loop;
  • otherwise the default loop interval is used.

This is non breaking change.

@pedrobranco pedrobranco merged commit 7cf2921 into master Nov 20, 2024
3 checks passed
@pedrobranco pedrobranco deleted the feature/loop-dynamic-interval branch November 20, 2024 10:34
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.

2 participants