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.
This commit is contained in:
Fabio Manganiello 2023-09-14 01:06:53 +02:00
parent 3104a59f44
commit 4cb5aa7acb
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 2 additions and 0 deletions

View File

@ -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)),