fix: keep cold Find Work reliable across workers (Closes #695)
This commit is contained in:
1 parent
47c6412a12
commit
df8385b325
3 files changed
+87
-4
No files matched your search
+7
-3
@@ -2767,14 +2767,18 @@ async def _available_issue_snapshot() -> tuple[list[dict], bool, bool, bool]:
|
||||
if _available_issue_snapshot_value is not None:
|
||||
return _available_issue_snapshot_value, True, True, False
|
||||
if not local_refresh:
|
||||
for _ in range(50):
|
||||
wait_deadline = time.monotonic() + WORK_PAGE_TIMEOUT_SECONDS
|
||||
while time.monotonic() < wait_deadline:
|
||||
await asyncio.sleep(0.02)
|
||||
shared = await asyncio.to_thread(_available_issue_snapshot_store.load)
|
||||
if shared.items is not None:
|
||||
return shared.items, False, False, False
|
||||
if not shared.refreshing:
|
||||
break
|
||||
raise RuntimeError("available issue catalog refresh is owned by another worker")
|
||||
local_refresh = await _start_available_issue_refresh()
|
||||
if local_refresh:
|
||||
break
|
||||
if not local_refresh:
|
||||
raise RuntimeError("available issue catalog refresh is owned by another worker")
|
||||
try:
|
||||
return await asyncio.shield(_available_issue_snapshot_task), False, False, False
|
||||
except Exception:
|
||||
|
||||
Reference in new issue
Block a user