timer, delay, sleep

Hi dev,

I love the speed and efficiency of doing network calls from the server, but it seems everything comes with a drawback when i need to loop through a large number of calls.

I believe I am hitting your api request rate limit.

I also think that if this limit would not be there, I could very well hit the destination api rate limit

so, i need to be able to slow things down and control the request rate/speed.

the timer api is not working so i assume that is a corona api and not core lua.

i am reading that the nginx lua module provide a sleep function so Im wondering if this is something that you would be able to implement? or any other wait to slow down/halt code?

anaqim

NOTE, when i did this on client side i could halt this by waiting for the async callback, but on the server everything just processes so much faster.

NOTE2 - Actually a delay is probably more appropriate then a sleep since code still need to be running while waiting. Maybe something based on coroutines?

NOTE3 - perhaps a delay parameter could be added to network requests? that would solve the issue elegantly

Hi again,

I solved the issue I was having so I was not hitting a request limit, but I still think it would be good to have a delay parameter for network request, provided that is possible of course.

i’m still getting this issue when running larger loops with calls.

i take it these network calls are done in multithreads and not sequencial, which would explain that this affect mostly larger batches.

if only there was a way to either delay them or call them sequencially :slight_smile:

Hi,

I think I have a solution for you, but it will be in the next release which should be in a few days.

-dev

Hi,

Stellar support as always  :slight_smile:

HI,

You should see if core.sleep will help with your issue. It’s new in 2.5.0.

-dev

Hi dev,

Thanks for the update, works fine :slight_smile:

Hi again,

I solved the issue I was having so I was not hitting a request limit, but I still think it would be good to have a delay parameter for network request, provided that is possible of course.

i’m still getting this issue when running larger loops with calls.

i take it these network calls are done in multithreads and not sequencial, which would explain that this affect mostly larger batches.

if only there was a way to either delay them or call them sequencially :slight_smile:

Hi,

I think I have a solution for you, but it will be in the next release which should be in a few days.

-dev

Hi,

Stellar support as always  :slight_smile:

HI,

You should see if core.sleep will help with your issue. It’s new in 2.5.0.

-dev

Hi dev,

Thanks for the update, works fine :slight_smile: