feat(wecom_bot): add Wecom Bot QR code scan auth

This commit is contained in:
zhayujie
2026-03-31 21:27:50 +08:00
parent 8744810b25
commit 66b71c50e9
6 changed files with 312 additions and 34 deletions

View File

@@ -244,10 +244,13 @@ class BrowserService:
with self._lock:
if self._alive and self._thread and self._thread.is_alive():
return
# Wait for old thread to fully exit before creating a new one
old = self._thread
if old and old.is_alive():
old.join(timeout=5)
# Fresh queue to avoid stale sentinels from a previous close()
self._task_queue = queue.Queue()
self._alive = True
# Reuse existing queue so tasks queued during restart are not lost
if self._task_queue is None:
self._task_queue = queue.Queue()
self._ready = threading.Event()
self._thread = threading.Thread(target=self._run_loop, daemon=True, name="BrowserThread")
self._thread.start()