Files
pad/internal/server
xarmian 0b3ca0d598 fix(events): a closed MemoryBus refuses a late subscribe instead of handing out a channel nothing will close (BUG-2737) (#1483)
cmd_server closes the event buses before srv.Shutdown drains handlers, so a
request already inside the SSE handler could subscribe after Close. MemoryBus
admitted it on all three doors and returned a channel nothing would ever close,
so the handler ranged over it until Shutdown's 30s deadline. RedisBus already
refused the same call with SubscribeFailed, as measured on main.

MemoryBus now answers SubscribeFailed, with a nil channel and no registration,
on Subscribe, SubscribeIfAllowed and SubscribeAndReplaySince once closed. The
resume door clears its resume-gap report first, as RedisBus does. The SSE
handler already maps SubscribeFailed to a 503 with Retry-After, which is the
right shutdown answer, and the two buses now answer a late subscriber alike.

Claude-Session: https://claude.ai/code/session_01RYiqbqXmxQMoKHsGm8B77N
2026-09-23 21:52:18 -04:00
..