Use retry on timeout flag for Redis connections

In order to avoid some fails due some high load peaks in our Redis
databases, we are going to active this flag that retries 1 more time
in case it receives a socket.Timeout error while reading or connecting
This commit is contained in:
Mario de Frutos 2016-04-04 10:11:37 +02:00
parent bfb8df54f4
commit a8dd211acf
2 changed files with 6 additions and 7 deletions

View File

@ -16,14 +16,13 @@ class RedisConnection:
sentinel = Sentinel([(self._config.host,
self._config.port)],
socket_timeout=self._config.timeout)
return sentinel.master_for(
self._config.sentinel_id,
socket_timeout=self._config.timeout,
db=self._config.db
)
return sentinel.master_for(self._config.sentinel_id,
socket_timeout=self._config.timeout,
db=self._config.db,
retry_on_timeout=True)
else:
conn = StrictRedis(host=self._config.host, port=self._config.port,
db=self._config.db,
db=self._config.db, retry_on_timeout=True,
socket_timeout=self._config.timeout)
return conn

View File

@ -10,7 +10,7 @@ from setuptools import setup, find_packages
setup(
name='cartodb_services',
version='0.4.2',
version='0.4.3',
description='CartoDB Services API Python Library',