Forum
    • Categories
    • Register
    • Login

    Extend time-out duration

    Scheduled Pinned Locked Moved C++ Development
    7 Posts 3 Posters 979 Views
    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.
    • ustkU
      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?

      Hise made me an F5 dude, any other app just suffers...

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

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

        Hise made me an F5 dude, any other app just suffers...

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

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

          ustkU 1 Reply Last reply Reply Quote 0
          • ustkU
            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...

            Hise made me an F5 dude, any other app just suffers...

            1 Reply Last reply Reply Quote 0
            • Christoph HartC
              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...

              ustkU 1 Reply Last reply Reply Quote 0
              • ustkU
                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...

                Hise made me an F5 dude, any other app just suffers...

                gorangroovesG 1 Reply Last reply Reply Quote 0
                • gorangroovesG
                  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

                  19

                  Online

                  2.2k

                  Users

                  13.4k

                  Topics

                  116.3k

                  Posts