From e2fc0c87cdde24a0019271911f63eb418953313c Mon Sep 17 00:00:00 2001 From: Moritz Sauter Date: Wed, 3 Nov 2021 17:13:17 +0100 Subject: [PATCH] Set client_id as thread name Helps when debugging in the resulting threads as the name is shown in the possible exception that can come up. Signed-off-by: Moritz Sauter --- src/paho/mqtt/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/paho/mqtt/client.py b/src/paho/mqtt/client.py index d479eae9..a050e05c 100644 --- a/src/paho/mqtt/client.py +++ b/src/paho/mqtt/client.py @@ -1808,7 +1808,7 @@ def loop_start(self): self._sockpairR, self._sockpairW = _socketpair_compat() self._thread_terminate = False - self._thread = threading.Thread(target=self._thread_main) + self._thread = threading.Thread(target=self._thread_main, name=f"paho-mqtt-client-{self._client_id.decode()}") self._thread.daemon = True self._thread.start()