Store: publish a search's completion and hand over its queue atomically

A query arriving between the queue handover and the completion event could be
queued with nobody to start it, leaving the source 'loading' forever.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
saphidandClaude Opus 5.5 committed 2026-09-28 22:28:45 +10:00
1 parent 5ac109c381
commit 4fd8bb79af
2 files changed
+24 -2

No files matched your search

+2 -2
View File
@@ -249,11 +249,11 @@ def _start(key, task):
task['error'] = str(e)
task['limited'] = isinstance(e, SourceLimited)
finally:
with _lock:
with _lock: # completion and queue handover are one step for _launch
queued = _pending.pop(key, None)
if queued:
_running[key] = queued
task['event'].set()
task['event'].set()
if queued:
_start(key, queued)
threading.Thread(target=run, daemon=True).start()