My applications need to poll every 2 seconds if there are changes. For now i use setInterval, but sometimes myFunction
takes longer then 2 seconds to execute and records in the mysql database will be inserted twice. I make use of the async lib in myFunction..
So i need this...
When myFunction is finished
method.myFunction() =>
It needs to run again (but only when it is finished). setInterval
with x seconds is not an option. This is because they can run at the same time if the scripts takes longer then x seconds.
How can i run myFunction
again after x seconds, but only when myFunction
is done with processing So in psuedo code it would be this
if method.myFunction == finished wait 2 seconds run method.myFunction again
via erwinnandpersad
No comments:
Post a Comment