<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi Nyall,</p>
    <p>Ok, I wasn't sure if they're being executed in another thread by
      default.</p>
    <p>Then it is weird. I'm not doing anything out of the ordinary I
      guess. I'm calling the client from <a moz-do-not-send="true"
href="https://github.com/nilsnolde/OSMtools/blob/345f9dce7893453baa80e22067fabdd17852e5ea/ORStools/proc/isochrones_proc.py#L164">within
        the algo</a>'s processAlgorithm() and the client sleeps on
      exception <a moz-do-not-send="true"
href="https://github.com/nilsnolde/OSMtools/blob/345f9dce7893453baa80e22067fabdd17852e5ea/ORStools/core/client.py#L161">here</a>.
      But even when it's not sleeping and only requesting, it's freezing
      the app.</p>
    <p>The algo from the branch in the links above works (not much else
      though atm), in case anyone wants to see it in action. There is an
      API key in that branch, so all ready to go. Will delete the key
      soon of course. If you try: best on a (single geometry) point
      layer with > 200 points.</p>
    <p>Anyways, hope someone can clear up the mystery.<br>
    </p>
    <p>Thanks<br>
      Nils<br>
    </p>
    <div class="moz-cite-prefix">On 08.12.18 05:20, Nyall Dawson wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAB28Ashb0fz0rWjtKngvoHfzswaVg6ypP5_BU3Tcr81jyn0OrQ@mail.gmail.com">
      <pre class="moz-quote-pre" wrap="">On Sat, 8 Dec 2018 at 09:14, Nils Nolde <a class="moz-txt-link-rfc2396E" href="mailto:nilsnolde@gmail.com"><nilsnolde@gmail.com></a> wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">
Hi,

I'd like to extend the openrouteservice API client plugin with a
processing provider, but I run into problems implementing an error catch
for 'Query limit exceeded' which is usually set to 40 requests/min. I
want the plugin to be able to continue requesting when it hits that
limit, after waiting the appropriate amount of time.

Currently I'm doing the following:

- The request is made in a 'client' module. That client module is called
by the processing algorithms (e.g. isochrones) whose input feature
source can have more than 40 features and likely exceed the minutely limit

- When the limit is exceeded, the 'client' module catches the HTTP error
and invokes a time.sleep() for (60 - seconds_since_first_request)
seconds, and then continues requesting

That freezes QGIS obviously, which is not what I want.

Any idea how to deal with this? I have no idea how to delay Python
execution without freezing the main application..
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
By default algorithms are executed in a background thread, so I'm
surprised to hear that you're getting a freeze here. Did you change
your algorithm to prevent this background execution? How are you
launching the algorithm?

Nyall

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">
Many thanks

Nils

_______________________________________________
QGIS-Developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
</pre>
      </blockquote>
    </blockquote>
  </body>
</html>