fix(project_events): use process-lifetime ctx for async SSE publish #8

Merged
oleks merged 1 commits from fix/sse-detach-ctx into main 2026-05-16 00:10:52 +03:00

1 Commits

Author SHA1 Message Date
Oleks 9ee232b18d fix(project_events): use process-lifetime ctx for async publish
The publish goroutine inherited the request context via
context.WithoutCancel. That context carries a request-scoped DB
session returned to the pool when the HTTP handler completes, so
GetProjectByID + access checks in the goroutine raced with session
teardown and intermittently returned empty recipient sets (uids=[]),
silently dropping every SSE board event. Root the detached context in
graceful.ShutdownContext() (global engine, process lifetime).

(cherry picked from commit bfc10289e6)
2026-05-16 00:09:08 +03:00