Hi Everyone,
I have a similar issue and after a bunch of searching have not found an answer.
Is there any way to issue a wait / delay of x seconds as a server action without a database connection and custom DB query?
Here is my scenario, using Server Actions, I call an api #1 (backend function, processing occurs etc…this takes a few seconds to execute say 10, this response is variable 5-20 seconds max). I then call api #2, this returns a status and some values that I need for my application scenario. If I call API #2 in sequence immediately, it get a IsReadyStatus returning “false” and I get a null value.
Ideally I would like a delay or sleep call in server actions.
Is it possible to do this with a while or repeat loop?
E.G.
Repeat until API#2 Status Call returns Ready
Issue API#2 call, get value for status
If IsReadyStatus is “True”, capture data values, exit
If IsReadyStatus is “false”, wait 2 seconds and retry
I still see the need for a delay or wait function as repeating executing against API #2 IMO is similar to a ddos attack on the API.
Any thoughts and recommendations on how to solve? Thanks!