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

Program breaks if 'callback' takes more time than 'dalay' in setInterval #2

Open
notadilnaqvi opened this issue Sep 27, 2020 · 0 comments

Comments

@notadilnaqvi
Copy link
Owner

setInterval(callback, delay) runs after delay milliseconds. If the callback takes more time to run than these delay milliseonds (because of slower API/database responses), the program will break.

In context of this program, it only takes about 15 seconds for the async callback to run once. The delay is set to 2 minutes to avoid said problem. This 2-minute delay gives callback plenty of time to finish. But this is not efficient as the program is sitting idle rest of the time.

A probable solution is to use the equivalent of a sleep function in Python details of which can be found here.

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