From 4cb5aa7acb6f3256364406f93869f0f81d8fb6d1 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 14 Sep 2023 01:06:53 +0200 Subject: [PATCH] Prepend the class name to the string used to generate the MQTT client_id hash. If we include the class name by default then we won't have to explicitly modify the client_id in the implementation classes in order to prevent clashes. --- platypush/plugins/mqtt/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platypush/plugins/mqtt/__init__.py b/platypush/plugins/mqtt/__init__.py index 5043634d..2ba0e394 100644 --- a/platypush/plugins/mqtt/__init__.py +++ b/platypush/plugins/mqtt/__init__.py @@ -143,6 +143,7 @@ class MqttPlugin(RunnablePlugin): self._listeners_lock = defaultdict(threading.RLock) self.listeners: Dict[str, MqttClient] = {} # client_id -> MqttClient map + self.timeout = timeout self.default_listener = ( self._get_client( host=host, @@ -188,6 +189,7 @@ class MqttPlugin(RunnablePlugin): client_hash = hashlib.sha1( '|'.join( [ + self.__class__.__name__, host, str(port), json.dumps(sorted(topics)),