Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix: clean up socket subscriptions by iterating research_id keys

haosenwang101824768c82178d
diff --git a/src/local_deep_research/web/services/socket_service.py b/src/local_deep_research/web/services/socket_service.py
index ad8ff4fa04..b1794c6cfb 100644
--- a/src/local_deep_research/web/services/socket_service.py
+++ b/src/local_deep_research/web/services/socket_service.py
@@ -209,10 +209,17 @@ class SocketIOService:
self.__log_info(
f"Client {request.sid} disconnected because: {reason}"
)
- # Clean up subscriptions for this client
+ # Clean up subscriptions for this client.
+ # __socket_subscriptions is keyed by research_id → set of sids,
+ # so we iterate all entries and discard the disconnecting sid.
with self.__lock:
- if request.sid in self.__socket_subscriptions:
- del self.__socket_subscriptions[request.sid]
+ empty_keys = []
+ for research_id, sids in self.__socket_subscriptions.items():
+ sids.discard(request.sid)
+ if not sids:
+ empty_keys.append(research_id)
+ for key in empty_keys:
+ del self.__socket_subscriptions[key]
self.__log_info(f"Removed subscription for client {request.sid}")
# Clean up any thread-local database sessions that may have been