Startup deletes the work queue's keys from before it moved from pipeline: to queue: (stream, timers, dead letters, parked lists, done markers), logged with what they held; an old stream still holding undelivered work stays, is logged as an error, and counts as queued work for the keys it names

This commit is contained in:
2026-11-03 07:55:14 +01:00
parent 3ae5255617
commit f9d5f510c2
4 changed files with 153 additions and 2 deletions
+4 -1
View File
@@ -317,7 +317,10 @@ async def lifespan(app: FastAPI) -> AsyncIterator[None]:
event_bus.flow_id_of = lambda key: store.key_index().get(key, key)
state = _state_backend()
queue = _work_queue()
# Then the rest of it, before anything reads alerts, devices, modules,
# What the queue left among the state keys before it had a root of
# its own, which a rename's state step would refuse.
await run_in_threadpool(queue.drop_legacy)
# Then the rest of the rename, before anything reads alerts, devices, modules,
# metrics, flows or runs. Until it is finished nothing is served.
await retry_until_done(lambda: recover_runtime(state, queue), event_bus)
# Work that arrived while a rename held the queue, which a crash