Browse Source

added kwargs to the __init__ of RedisManager in order to pass more parameters

in this case used to optionally set redis client name
add kwargs to zmq_manager.py and kombu_manager.py
pull/154/head
Iddo Tal 8 years ago
parent
commit
52bd3e7aa3
  1. 2
      socketio/kombu_manager.py
  2. 4
      socketio/redis_manager.py
  3. 2
      socketio/zmq_manager.py

2
socketio/kombu_manager.py

@ -38,7 +38,7 @@ class KombuManager(PubSubManager): # pragma: no cover
name = 'kombu' name = 'kombu'
def __init__(self, url='amqp://guest:guest@localhost:5672//', def __init__(self, url='amqp://guest:guest@localhost:5672//',
channel='socketio', write_only=False): channel='socketio', write_only=False, **kwargs):
if kombu is None: if kombu is None:
raise RuntimeError('Kombu package is not installed ' raise RuntimeError('Kombu package is not installed '
'(Run "pip install kombu" in your ' '(Run "pip install kombu" in your '

4
socketio/redis_manager.py

@ -33,12 +33,14 @@ class RedisManager(PubSubManager): # pragma: no cover
name = 'redis' name = 'redis'
def __init__(self, url='redis://localhost:6379/0', channel='socketio', def __init__(self, url='redis://localhost:6379/0', channel='socketio',
write_only=False): write_only=False, **kwargs):
if redis is None: if redis is None:
raise RuntimeError('Redis package is not installed ' raise RuntimeError('Redis package is not installed '
'(Run "pip install redis" in your ' '(Run "pip install redis" in your '
'virtualenv).') 'virtualenv).')
self.redis = redis.Redis.from_url(url) self.redis = redis.Redis.from_url(url)
if "client_name" in kwargs:
self.redis.client_setname(kwargs["client_name"])
self.pubsub = self.redis.pubsub() self.pubsub = self.redis.pubsub()
super(RedisManager, self).__init__(channel=channel, super(RedisManager, self).__init__(channel=channel,
write_only=write_only) write_only=write_only)

2
socketio/zmq_manager.py

@ -50,7 +50,7 @@ class ZmqManager(PubSubManager): # pragma: no cover
def __init__(self, url='zmq+tcp://localhost:5555+5556', def __init__(self, url='zmq+tcp://localhost:5555+5556',
channel='socketio', channel='socketio',
write_only=False): write_only=False, **kwargs):
if zmq is None: if zmq is None:
raise RuntimeError('zmq package is not installed ' raise RuntimeError('zmq package is not installed '
'(Run "pip install pyzmq" in your ' '(Run "pip install pyzmq" in your '

Loading…
Cancel
Save