fix(resilience): drain heavyweight SSE on SIGTERM (#11020)

Validated on the combined batch board + this branch alone: chat-body-admission + authz/pipeline 65/65, file-size gate green with a dated frozen entry (chatBodyAdmission 1005→1009 — the +4 lease/drain wiring lines, owner-authorized rebaseline). trackRequest was never called, so SIGTERM waitForDrain saw zero in-flight and killed live SSE; leases now hold the drain counter for the stream's lifetime, and the 503 carries Retry-After. Closes #11015. Thank you @RaviTharuma!
This commit is contained in:
Ravi Tharuma
2026-08-23 03:51:02 +02:00
committed by GitHub
parent e73ab0040c
commit 230017196c
7 changed files with 65 additions and 3 deletions

View File

@@ -205,6 +205,7 @@ function drainingResponse(requestId: string): NextResponse {
{ status: 503 }
);
response.headers.set(AUTHZ_HEADER_REQUEST_ID, requestId);
response.headers.set("Retry-After", "5");
return response;
}