From f1cd40f7e7aa9cae432116ed1f2e369fef6e962a Mon Sep 17 00:00:00 2001 From: Alberto Romeu Date: Wed, 26 Feb 2020 19:52:56 +0100 Subject: [PATCH] add qps_retry to tomtom bulk API calls --- .../cartodb_services/cartodb_services/tomtom/bulk_geocoder.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/lib/python/cartodb_services/cartodb_services/tomtom/bulk_geocoder.py b/server/lib/python/cartodb_services/cartodb_services/tomtom/bulk_geocoder.py index 400cc2a..8995200 100644 --- a/server/lib/python/cartodb_services/cartodb_services/tomtom/bulk_geocoder.py +++ b/server/lib/python/cartodb_services/cartodb_services/tomtom/bulk_geocoder.py @@ -3,6 +3,7 @@ from requests.adapters import HTTPAdapter from cartodb_services import StreetPointBulkGeocoder from cartodb_services.geocoder import geocoder_error_response from cartodb_services.tomtom import TomTomGeocoder +from cartodb_services.tools.qps import qps_retry from cartodb_services.tools.exceptions import ServiceException @@ -59,6 +60,7 @@ class TomTomBulkGeocoder(TomTomGeocoder, StreetPointBulkGeocoder): self._logger.error(msg, e) return [geocoder_error_response(msg)] * len(searches) + @qps_retry(qps=5, provider='tomtom') def _send_batch(self, searches): body = {'batchItems': [{'query': self._query(s)} for s in searches]} request_params = { @@ -76,6 +78,7 @@ class TomTomBulkGeocoder(TomTomGeocoder, StreetPointBulkGeocoder): self._logger.error(msg) raise ServiceException(msg, response) + @qps_retry(qps=5, provider='tomtom') def _download_results(self, location): stalled_retries = 0 while True: