[QGIS-Developer] How to deal with time delay in QgsProcessingAlgorithm?
Nils Nolde
nilsnolde at gmail.com
Fri Dec 7 15:14:20 PST 2018
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..
Many thanks
Nils
More information about the QGIS-Developer
mailing list