I have a synchronous function inside setInterval() where I have set the timeout to 1 second. At times, the synchronous function inside setInterval() takes 30+ seconds to execute. Meaning, the function defined inside setInterval() is taking more than timeout set. Recently, I have been facing lot of issues inside this function which im not able to track.
Can anyone tell me if it is a problem when function inside setInterval takes more than the timeout? Or if theres any other ideal way to keep on calling a function whose execution time is unpredictable?
Sample Code:
myFunction = async()=>{
// Some synchronous external API calls which takes 30+ seconds to execute
}
setInterval(myFunction,1000)