CurlsMBS: launch a new CURL in the finished event of another CURL


In a web app, via handleSpecialURL, I launch a thread, which launches a Curl request with curlsMBS and performMT.

In the “finished” event of the curlsMBS object, I launch a new thread, which launches a new Curl request with performMT. it seems to work well.

But is it safe to launch a new CURL request in the “finished” event of another Curl request? Or is it better to launch a timer in the “finished” event to start the new request than a second later, for example?

Thank you

Translated with

What about a finished boolean set to true… And a poll to this variable to launch another download request ?

I used that with curl in AppleScript years agoto download lots of individual files.

That’s perfectly fine. You are separating the request from the event loop of the parent request by starting a new thread, so a timer would not make a real difference in terms of use safety. Like you said, things that can get you into trouble include reusing a socket from inside one of its events or getting into an endless event loop. Both will not happen with your approach.

Great, thanks Ulrich!