diff --git a/platypush/backend/sensor/__init__.py b/platypush/backend/sensor/__init__.py index eaae125447..7a57728948 100644 --- a/platypush/backend/sensor/__init__.py +++ b/platypush/backend/sensor/__init__.py @@ -1,3 +1,4 @@ +import threading import time from platypush.backend import Backend @@ -174,7 +175,7 @@ class SensorBackend(Backend): if plugin and hasattr(plugin, 'close'): plugin.close() - def process_data(self, data, new_data): + def process_data(self, new_data): if new_data is not None and new_data not in ({}, []): self.bus.post(SensorDataChangeEvent(data=new_data, source=self.plugin or self.__class__.__name__)) @@ -186,7 +187,7 @@ class SensorBackend(Backend): try: data = self.get_measurement() new_data = self.get_new_data(data) - self.process_data(data, new_data) + self.process_data(new_data) data_below_threshold = {} data_above_threshold = {} diff --git a/platypush/bus/redis.py b/platypush/bus/redis.py index 42e874d3ef..1c64e8b36d 100644 --- a/platypush/bus/redis.py +++ b/platypush/bus/redis.py @@ -14,7 +14,7 @@ class RedisBus(Bus): """ Overrides the in-process in-memory local bus with a Redis bus """ _DEFAULT_REDIS_QUEUE = 'platypush/bus' - def __init__(self, on_message=None, redis_queue=None, *args, **kwargs): + def __init__(self, *args, on_message=None, redis_queue=None, **kwargs): super().__init__(on_message=on_message) if not args and not kwargs: @@ -26,7 +26,7 @@ class RedisBus(Bus): self.on_message = on_message self.thread_id = threading.get_ident() - def get(self, parse: bool = True): + def get(self): """ Reads one message from the Redis queue """ try: if self.should_stop(): @@ -37,9 +37,7 @@ class RedisBus(Bus): return msg = msg[1].decode('utf-8') - if parse: - return Message.build(msg) - return msg + return Message.build(msg) except Exception as e: logger.exception(e)