Passing socket_timeout=transition_seconds attribute to _get_redis

This commit is contained in:
Fabio Manganiello 2019-01-20 00:36:07 +01:00
parent c7decd81f2
commit d1b9fef740

View file

@ -660,7 +660,7 @@ class LightHuePlugin(LightPlugin):
def _should_stop(): def _should_stop():
try: try:
redis = self._get_redis() redis = self._get_redis(transition_seconds)
redis.blpop(self.ANIMATION_CTRL_QUEUE_NAME) redis.blpop(self.ANIMATION_CTRL_QUEUE_NAME)
return True return True
except QueueTimeoutError: except QueueTimeoutError:
@ -723,10 +723,10 @@ class LightHuePlugin(LightPlugin):
args=(lights,)) args=(lights,))
self.animation_thread.start() self.animation_thread.start()
def _get_redis(self): def _get_redis(self, socket_timeout=1.0):
if not self.redis: if not self.redis:
redis_args = get_backend('redis').redis_args redis_args = get_backend('redis').redis_args
redis_args['socket_timeout'] = transition_seconds redis_args['socket_timeout'] = socket_timeout
self.redis = Redis(**redis_args) self.redis = Redis(**redis_args)
return self.redis return self.redis