Merge pull request #320 from CartoDB/317-revert-retries

Revert number of isochrone retries to 3
This commit is contained in:
Javier Goizueta 2016-12-13 18:00:48 +01:00 committed by GitHub
commit 16cce3bddc
5 changed files with 9 additions and 9 deletions

View File

@ -18,7 +18,7 @@ class HereMapsGeocoder(Traceable):
DEFAULT_GEN = 9 DEFAULT_GEN = 9
READ_TIMEOUT = 60 READ_TIMEOUT = 60
CONNECT_TIMEOUT = 10 CONNECT_TIMEOUT = 10
MAX_RETRIES=3 MAX_RETRIES=1
ADDRESS_PARAMS = [ ADDRESS_PARAMS = [
'city', 'city',
@ -92,7 +92,7 @@ class HereMapsGeocoder(Traceable):
request_params.update(params) request_params.update(params)
# TODO Extract HTTP client wrapper # TODO Extract HTTP client wrapper
session = requests.Session() session = requests.Session()
session.mount(self.host, HTTPAdapter(self.MAX_RETRIES)) session.mount(self.host, HTTPAdapter(max_retries=self.MAX_RETRIES))
response = session.get(self.host, params=request_params, response = session.get(self.host, params=request_params,
timeout=(self.CONNECT_TIMEOUT, self.READ_TIMEOUT)) timeout=(self.CONNECT_TIMEOUT, self.READ_TIMEOUT))
self.add_response_data(response, self._logger) self.add_response_data(response, self._logger)

View File

@ -14,7 +14,7 @@ class HereMapsRoutingIsoline(Traceable):
ISOLINE_PATH = '/routing/7.2/calculateisoline.json' ISOLINE_PATH = '/routing/7.2/calculateisoline.json'
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",
@ -57,7 +57,7 @@ class HereMapsRoutingIsoline(Traceable):
parsed_options) parsed_options)
# TODO Extract HTTP client wrapper # TODO Extract HTTP client wrapper
session = requests.Session() session = requests.Session()
session.mount(self._url, HTTPAdapter(self.MAX_RETRIES)) session.mount(self._url, HTTPAdapter(max_retries=self.MAX_RETRIES))
response = requests.get(self._url, params=request_params, response = requests.get(self._url, params=request_params,
timeout=(self.CONNECT_TIMEOUT, self.READ_TIMEOUT)) timeout=(self.CONNECT_TIMEOUT, self.READ_TIMEOUT))
self.add_response_data(response, self._logger) self.add_response_data(response, self._logger)

View File

@ -15,7 +15,7 @@ class MapzenGeocoder(Traceable):
BASE_URL = 'https://search.mapzen.com/v1/search' BASE_URL = 'https://search.mapzen.com/v1/search'
READ_TIMEOUT = 60 READ_TIMEOUT = 60
CONNECT_TIMEOUT = 10 CONNECT_TIMEOUT = 10
MAX_RETRIES = 3 MAX_RETRIES = 1
def __init__(self, app_key, logger, base_url=BASE_URL): def __init__(self, app_key, logger, base_url=BASE_URL):
self._app_key = app_key self._app_key = app_key
@ -31,7 +31,7 @@ class MapzenGeocoder(Traceable):
try: try:
# TODO Extract HTTP client wrapper # TODO Extract HTTP client wrapper
session = requests.Session() session = requests.Session()
session.mount(self._url, HTTPAdapter(self.MAX_RETRIES)) session.mount(self._url, HTTPAdapter(max_retries=self.MAX_RETRIES))
response = session.get(self._url, params=request_params, response = session.get(self._url, params=request_params,
timeout=(self.CONNECT_TIMEOUT, self.READ_TIMEOUT)) timeout=(self.CONNECT_TIMEOUT, self.READ_TIMEOUT))
self.add_response_data(response, self._logger) self.add_response_data(response, self._logger)

View File

@ -32,7 +32,7 @@ class MapzenIsochrones:
try: try:
# TODO Extract HTTP client wrapper # TODO Extract HTTP client wrapper
session = requests.Session() session = requests.Session()
session.mount(self._url, HTTPAdapter(self.MAX_RETRIES)) session.mount(self._url, HTTPAdapter(max_retries=self.MAX_RETRIES))
response = session.get(self._url, params=request_params, response = session.get(self._url, params=request_params,
timeout=(self.CONNECT_TIMEOUT, timeout=(self.CONNECT_TIMEOUT,
self.READ_TIMEOUT)) self.READ_TIMEOUT))

View File

@ -15,7 +15,7 @@ class MapzenRouting(Traceable):
PRODUCTION_ROUTING_BASE_URL = 'https://valhalla.mapzen.com/route' PRODUCTION_ROUTING_BASE_URL = 'https://valhalla.mapzen.com/route'
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",
@ -50,7 +50,7 @@ class MapzenRouting(Traceable):
request_params = self.__parse_request_parameters(json_request_params) request_params = self.__parse_request_parameters(json_request_params)
# TODO Extract HTTP client wrapper # TODO Extract HTTP client wrapper
session = requests.Session() session = requests.Session()
session.mount(self._url, HTTPAdapter(self.MAX_RETRIES)) session.mount(self._url, HTTPAdapter(max_retries=self.MAX_RETRIES))
response = session.get(self._url, params=request_params, response = session.get(self._url, params=request_params,
timeout=(self.CONNECT_TIMEOUT, self.READ_TIMEOUT)) timeout=(self.CONNECT_TIMEOUT, self.READ_TIMEOUT))
self.add_response_data(response, self._logger) self.add_response_data(response, self._logger)