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

  1. 3 weeks ago

    olivier v

    Dec 26 Pre-Release Testers, Xojo Pro Europe (France)

    Hi,

    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
    Olivier

    Translated with www.DeepL.com/Translator

    @olivier v 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?

    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.

  2. Emile S

    Dec 27 Europe (France, Strasbourg)

    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.

  3. Ulrich B

    Dec 27 Pre-Release Testers, Xojo Pro Answer Europe (Germany, Berlin) · xo...

    @olivier v 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?

    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.

  4. olivier v

    Dec 27 Pre-Release Testers, Xojo Pro Europe (France)

    Great, thanks Ulrich!

or Sign Up to reply!