Let's say I have this pseudo code:
var STATUS = '';
while (STATUS !== "SUCCEEDED") {
STATUS = getStatus();
anotherFunc();
delay(3s);
}
The goal of this code is to keep calling an api to check a status of something, the api returns IN_PROGRESS or SUCCEEDED. So I want the while loop to keep calling getStatus() to get the value of STATUS and break the loop when it is SUCCEEDED. I also want to put a delay between each iteration.
This can't be done easily with Nodejs. So please help me out.
setTimeout()-based retries?