Skip to content

Commit b475a74

Browse files
committed
Merge branch 'master' into dont_override_logging_root_handler
2 parents 2b78e44 + b07f6d6 commit b475a74

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pyres/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class ResQ(object):
116116
117117
The ``__init__`` takes these keyword arguments:
118118
119-
``server`` -- IP address and port of the Redis server to which you want to connect. Default is `localhost:6379`.
119+
``server`` -- IP address and port of the Redis server to which you want to connect, and optional Redis DB number. Default is `localhost:6379`.
120120
121121
``password`` -- The password, if required, of your Redis server. Default is "None".
122122
@@ -188,8 +188,9 @@ def _get_redis(self):
188188
def _set_redis(self, server):
189189
if isinstance(server, basestring):
190190
self.dsn = server
191-
host, port = server.split(':')
192-
self._redis = Redis(host=host, port=int(port), password=self.password)
191+
address, _, db = server.partition('/')
192+
host, port = address.split(':')
193+
self._redis = Redis(host=host, port=int(port), db=int(db or 0), password=self.password)
193194
self.host = host
194195
self.port = int(port)
195196
elif isinstance(server, Redis):

pyres/worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Worker(object):
1919
class and passes a comma-separated list of queues to listen on.::
2020
2121
>>> from pyres.worker import Worker
22-
>>> Worker.run([queue1, queue2], server="localhost:6379")
22+
>>> Worker.run([queue1, queue2], server="localhost:6379/0")
2323
2424
"""
2525

0 commit comments

Comments
 (0)