Merge pull request #318 from CartoDB/317-timeouts-patch
317 timeouts patch
This commit is contained in:
commit
f716fbb502
@ -13,7 +13,7 @@ class MapzenIsochrones:
|
|||||||
BASE_URL = 'https://matrix.mapzen.com/isochrone'
|
BASE_URL = 'https://matrix.mapzen.com/isochrone'
|
||||||
READ_TIMEOUT = 60
|
READ_TIMEOUT = 60
|
||||||
CONNECT_TIMEOUT = 10
|
CONNECT_TIMEOUT = 10
|
||||||
MAX_RETRIES = 3
|
MAX_RETRIES = 1
|
||||||
|
|
||||||
ACCEPTED_MODES = {
|
ACCEPTED_MODES = {
|
||||||
"walk": "pedestrian",
|
"walk": "pedestrian",
|
||||||
@ -25,7 +25,7 @@ class MapzenIsochrones:
|
|||||||
self._url = base_url
|
self._url = base_url
|
||||||
self._logger = logger
|
self._logger = logger
|
||||||
|
|
||||||
@qps_retry
|
@qps_retry(qps=7)
|
||||||
def isochrone(self, locations, costing, ranges):
|
def isochrone(self, locations, costing, ranges):
|
||||||
request_params = self._parse_request_params(locations, costing,
|
request_params = self._parse_request_params(locations, costing,
|
||||||
ranges)
|
ranges)
|
||||||
|
@ -55,7 +55,7 @@ class QPSService:
|
|||||||
|
|
||||||
def retry(self, first_request_time, retry_count):
|
def retry(self, first_request_time, retry_count):
|
||||||
elapsed = datetime.now() - first_request_time
|
elapsed = datetime.now() - first_request_time
|
||||||
if elapsed.microseconds > (self._retry_timeout * 1000.0):
|
if elapsed.microseconds > (self._retry_timeout * 1000.0 * 1000.0):
|
||||||
raise TimeoutException()
|
raise TimeoutException()
|
||||||
|
|
||||||
# inverse qps * (1.5 ^ i) is an increased sleep time of 1.5x per
|
# inverse qps * (1.5 ^ i) is an increased sleep time of 1.5x per
|
||||||
|
@ -10,7 +10,7 @@ from setuptools import setup, find_packages
|
|||||||
setup(
|
setup(
|
||||||
name='cartodb_services',
|
name='cartodb_services',
|
||||||
|
|
||||||
version='0.12.1',
|
version='0.12.2',
|
||||||
|
|
||||||
description='CartoDB Services API Python Library',
|
description='CartoDB Services API Python Library',
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user