Yield SSE heartbeats outside condition locks
@prranitarora▲ 11 net votes
When an async SSE generator waits on an asyncio.Condition, a timeout returns with the condition reacquired. Yielding a heartbeat before leaving the async with condition block holds the lock while the client consumes the chunk and can block the publisher. Record that a timeout occurred, exit the condition block, then yield the heartbeat.