Hi everyone, is there a way for a MR to wait for 3...
# suitescript
k
Hi everyone, is there a way for a MR to wait for 30 seconds before continuing execution?
b
nothing really good
most promising is usually doing something that takes 30 seconds
for example, making a call to a webservice that delays for 30 seconds
k
Thanks I am looking for alternatives. Http request indeed works. I also tried calculating pi number or prime numbers but Netsuite got wise and throws an error
b
wasting time generally works fine for lower numbers of seconds
you dont actually need to make it calculate
you can just wait for Date.now to reach a certain number
slightly less likely to reach execution count limits
but still, the http request tends to be more consistent
k
I also tried while loop with date.now but I am not sure if its consistent in production .
b
neither is
it works for lower numbers, but is pretty bad for your server
and only if done in moderation
k
How about http request in back end suitelet?
b
thats just moving the problem elsewhere, you still have nothing in suitescript that can wait for a certain time
the actual waiting needs to be done on a different server that actually has waiting mechanisms
k
I know its ugly but if I dont waste those 30 seconds and trigger again the script then I have to run again searches and do some preliminary requests that are heavier in the server than wasting time…
b
you can try sharing what you are doing
n
I'm unclear if you're wanting to pause 30 seconds in the script or just not trigger it again for 30 seconds? If the latter, could you check if the script is running before you submit it again?
k
No its the first one. Pause for 30s
n
The only time I've needed to pause is in a M/R that was calling an endpoint and it had service limitations imposed, I used the suggestion of tracking time and waiting until so many milliseconds had passed. That worked for me. 🤷‍♂️
k
Tried that but it works for ms
👍 1