Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm working on a job to continually call an API every X seconds (lets say 30 seconds), extract some data from the response (lets call it the "status" field of some JSON) and then either kill the job if the status matches some desired status, or wait and call the API again. In the future I might want to extend this time to 10 minutes, up to 30 minutes maybe.
What do you think is the best way to do this? I currently have a setup of an outer loop that determines the Number of times to call the API, then an inner loop that uses some datetime logic to continually check if X number of seconds has passed (see attachment, but ignore if you already get what I'm saying). But I'm worried about performance for this method, since the inner loop could easily run tens of thousands of times depending on how many seconds it is waiting.
I also see the infinite loop option, but that number is in milliseconds. When using this component, is it the developer's responsibility to create some logical check to eventually break out of the loop?
For anyone who stumbles upon this...turns out there is a tSleep component that does this exact thing! Pretty easy, and way better than having a loop that checks the elapsed time every iteration.