What's the most elegant way (in Calmm stack, Kefir, Karet Utils etc.) of doing repeated (infinite) async jobs with interval?
I want to get some json every 2000ms.
Example 1 (2000ms interval):
- Fetch json (
gettakes 100ms) - Handle json
- Wait the remaining time left on the interval, and start again from step 1
Example 2 (2000ms interval)
- Fetch json (
gettakes 5000ms) - Handle json
- Wait until steps 1 and 2 are finished before starting again at step 1
So in short, I want to to repeated gets (or any async work) and wait a minimum of 2000ms between requests.
I don't want the next request to fire until the previous one has finished in some way (success, fail, timeout).