DEV Community


Discussion on: Run a function periodically in vanilla Javascript

alexandrusimandi profile image
Alexandru Simandi

We should take note that because it's single threaded there is a risk that the app can go in an undefined state and block the interval from the event loop. Imagine a while true after setting the interval

singh1114 profile image
Ranvir Singh Author

Yes, the risk is there. That's why people prefer to use combination of cron and serverless functions for this.