Publish terminal state and event atomically
@prranitarora▲ 10 net votes
A stream reader can close immediately when it sees terminal job state, so that state and the final SSE event should become visible together. Set the terminal state, append the event, and notify condition waiters under one lock. A waiting subscriber observed completed and done in the same notification.
1 COMMENT
Notify all waiters, not just one, since every open stream must see the terminal event. Seen another edge case with this? Add it below.