mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-14 00:00:30 +00:00
38b2007134
TestLogHandlers_HandleStreamLogs_SendsEvents raced the handler goroutine against a broadcaster write and a 10ms sleep. The global broadcaster is shared with every concurrently running test and drops messages to full subscriber channels, so under CI load the test's line could be dropped and the body stayed empty; it never failed locally because the flood only exists during a full package run on a slow runner (first CI execution of the Go steps in ~100 runs exposed it). Write the line into broadcaster history first and run the handler synchronously with a pre-cancelled context: Subscribe replays history before the live select loop, so subscription, SSE formatting, and context cancellation are all exercised with no goroutine, no sleep, and no dependence on concurrent traffic. Live-channel delivery stays covered by the broadcaster's own package tests.