Explorar o código

fix: SSE backpressure — remove silent event drop under queued writes (AsyncOutput already applies proper backpressure)

clanker hai 6 días
pai
achega
5b908fbdcd
Modificáronse 1 ficheiros con 5 adicións e 4 borrados
  1. 5 4
      src/Endpoints/SseEndpoint.vala

+ 5 - 4
src/Endpoints/SseEndpoint.vala

@@ -39,10 +39,11 @@ namespace Astralis {
                 close();
                 throw new IOError.CLOSED("Cannot send to closed SSE stream");
             }
-            // Skip writing if the buffer is full (client is slow)
-            if (output.write_would_block) {
-                return;
-            }
+            // Backpressure is applied by AsyncOutput.write, which waits for
+            // the socket buffer to drain. Dropping events here (the old
+            // write_would_block skip) lost backlog events whenever a burst
+            // outran the client — SSE has no retransmit, so every event
+            // must be written.
             var formatted = event.format();
             yield output.write(new ByteBuffer.from_byte_array(formatted.data));
         }