[QGIS-Developer] How to deal with time delay in QgsProcessingAlgorithm?

Nyall Dawson nyall.dawson at gmail.com
Fri Dec 7 18:20:13 PST 2018


On Sat, 8 Dec 2018 at 09:14, Nils Nolde <nilsnolde at gmail.com> wrote:
>
> 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..

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

>
> Many thanks
>
> Nils
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list