]> git.treefish.org Git - mtxbot.git/commitdiff
avoid race condition on stop
authorAlexander Schmidt <alex@treefish.org>
Sat, 3 Oct 2020 09:31:59 +0000 (11:31 +0200)
committerAlexander Schmidt <alex@treefish.org>
Sat, 3 Oct 2020 09:31:59 +0000 (11:31 +0200)
src/presence.py

index 0a7b1a13888f5085d44431911c9c1c9a9d7da380..4c7e966a5d9cd4de89439d4662a4fb425a772c5a 100644 (file)
@@ -21,6 +21,11 @@ class Presence:
         self._log(logging.INFO, "Presence stopped")
 
     def stop(self):
+        asyncio.get_running_loop().call_soon_threadsafe(
+            Presence._do_stop, self
+        )
+
+    def _do_stop(self):
         self._stop = True
         fifo = -1
         try: