Forum

    • Register
    • Login
    • Search
    • Categories

    Extend time-out duration

    C++ Development
    3
    7
    90
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ustk
      ustk last edited by

      @Christoph-Hart I have a long task with variable duration (server request). So sometimes I get an Execution timed-out error.

      How can I deal with it?
      Is it possible to extend the duration? (I've seen the extendTimeOutAPI is only for compile-time and has no influence on the compiled plugin)
      Does the error have an impact on the compiled plugin?

      I can't help pressing F5 in the forum...

      1 Reply Last reply Reply Quote 0
      • ustk
        ustk last edited by

        @Christoph-Hart Is there a way to make server request asynchronous?

        I can't help pressing F5 in the forum...

        1 Reply Last reply Reply Quote 0
        • Christoph Hart
          Christoph Hart last edited by

          You could give it a timer that checks every 500ms, but how do you do a server request?

          ustk 1 Reply Last reply Reply Quote 0
          • ustk
            ustk @Christoph Hart last edited by

            @Christoph-Hart I used the juce url input stream
            It's not clear to me where/how to implement this timer...

            I can't help pressing F5 in the forum...

            1 Reply Last reply Reply Quote 0
            • Christoph Hart
              Christoph Hart last edited by

              Ah, so you've added a Scripting API call for that? In this case you will need to break the call up into something that calls the server and a scripting API call that checks the response, something like this:

              
              const var asyncCheck = Engine.createTimerObject();
              
              asyncCheck.setTimerCallback(function()
              {
                  if(Server.gotSomeResponse())
                  {
                      // Do something
                      this.stopTimer();
                  }
              });
              
              Server.call("http://someaddress.");
              
              asyncCallback.startTimer(500);
              

              A more cleaner approach would be:

              function serverDoneCallback(obj)
              {
                  Console.print(obj.status); // the status code (200 for OK)
                  Console.print(obj.response); // the data 
              };
              
              Server.callWithCallback("http://myaddress.com", serverDoneCallback);
              

              But that requires some non-trivial wrapping on the C++ side...

              ustk 1 Reply Last reply Reply Quote 0
              • ustk
                ustk @Christoph Hart last edited by

                @Christoph-Hart Oh great I see! At least for the first one, the second might be too high level for me at the moment 🙂
                Currently, I have one function that does the request and waits for the answer at once... Will try to split that...

                I can't help pressing F5 in the forum...

                gorangrooves 1 Reply Last reply Reply Quote 0
                • gorangrooves
                  gorangrooves @ustk last edited by

                  @ustk What are you trying to achieve?

                  Goran Rista
                  https://gorangrooves.com

                  Handy Drums and Handy Grooves
                  https://library.gorangrooves.com

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post

                  14
                  Online

                  1.1k
                  Users

                  6.8k
                  Topics

                  62.4k
                  Posts