Skip to content

Commit ee677c0

Browse files
committed
add retry_connection timeout parameters
1 parent e5ed810 commit ee677c0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/pyres/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ def str_to_class(s):
4242

4343
class ResQ(object):
4444

45-
def __init__(self, server="localhost:6379", password=None):
45+
def __init__(self, server="localhost:6379", password=None,
46+
timeout=None, retry_connection=True):
47+
self.timeout = timeout
48+
self.retry_connection = retry_connection
4649
self.redis = server
4750
if password:
4851
self.redis.auth(password)
@@ -85,7 +88,9 @@ def _set_redis(self, server):
8588
if isinstance(server, basestring):
8689
self.dsn = server
8790
host, port = server.split(':')
88-
self._redis = Redis(host=host, port=int(port))
91+
self._redis = Redis(host=host, port=int(port),
92+
retry_connection=self.retry_connection,
93+
timeout=self.timeout)
8994
elif isinstance(server, Redis):
9095
self.dsn = '%s:%s' % (server.host,server.port)
9196
self._redis = server

0 commit comments

Comments
 (0)