I'm looking for a way to periodically perform a background activity where the execution time of the activity might exceed the polling interval.
In java terms I'd use Executor.scheduleWithFixedDelay. This ensures that subsequent invocations only get called once the running task has completed, so only one instance of the task is running at any given time and it will always wait for the desired interval before polling again.
Currently I need to remember to make each activity reschedule itself upon completion. Is there a node.js / javascript library that achieves the same thing?