Page 1 of 1

tsNetPost is asynchronous. Is the callback blocking?

Posted: Tue Feb 06, 2024 11:26 am
by trevix
In my standalone, inside a loop, I do more than one tsNetPost to Azure at a time, while the app does other things that must not be blocked by a "post".
In order to not confuse the Azure WebApp, inside the loop I set a "wait for Flag" after each tsNetPost command.
Something like this:

Code: Select all

repeat xxx
    put false into sWebUploadDone --flag
    put tsNetPost(pID,tURL,tHeaders,tServerString,"postResponse") into tError
    wait until sWebUploadDone with messages
...
end repeat

on postResponse pID, pStatus, pBytes, pResult
    put true into sWebUploadDone
    --handle errors and returned data
...
...
end postResponse
It seems to be working but haven't tested it with big numbers.
So, while tsNetPost is not blocking, is the call back script also not blocking?
Thanks.
Trevix

Re: tsNetPost is asynchronous. Is the callback blocking?

Posted: Wed Feb 07, 2024 11:19 pm
by stam
Honestly couldn't say for sure but suspect that's up to your code. Pretty sure the callback isn't blocking or non-blocking by default...
If you find your code is blocking and can't solve it (eg by adding something like 'wait 0 with messages' inside loops), you can always post it here.