fix: streaming reliability, timeout, memory leaks, and retry improvements
- Fix streaming timeout: use AbortController for connection-only timeout instead of AbortSignal.timeout() that kills active SSE streams - Fix fetchViaCurl: stream body via ReadableStream instead of buffering entire response in memory - Fix JWT/aichat race condition: add Promise dedup to prevent concurrent bootstrap calls (10 requests = 1 bootstrap, not 10) - Fix ACTIVE_READERS memory leak: auto-remove readers on stream completion - Fix WebSocket backpressure: log warning when client buffer exceeds 1MB - Add SSE heartbeat/keepalive: send ': keepalive' every 15s to prevent LB/proxy timeout during AI thinking - Fix SSELineBuffer: graceful overflow handling (warn + discard instead of throwing error that crashes stream) - Fix transformStream tight loop: yield to event loop after each chunk to prevent starvation - Fix fetchViaCurl process cleanup: use SIGKILL + proper timeout cleanup - Add retry on 502/504: retry transient server errors before returning to caller (both fetchWithRetry and fetchWithSessionRetry)
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ services:
|
||||
network_mode: host
|
||||
environment:
|
||||
HOST: "::"
|
||||
PORT: "3000"
|
||||
PORT: "4060"
|
||||
IPV6_SOURCES: "2001:df4:c140:1f::8,2001:df4:c140:1f::395,2001:df4:c140:1f::d9,2001:df4:c140:1f::db,2001:df4:c140:1f::dd,2001:df4:c140:1f::de,2001:df4:c140:1f::df,2001:df4:c140:1f:ffff:ffff:ffff:1,2001:df4:c140:1f:ffff:ffff:ffff:2,2001:df4:c140:1f:ffff:ffff:ffff:ff,2001:df4:c140:1f:ffff:ffff:ffff:100,2001:df4:c140:1f:ffff:ffff:ffff:f000,2001:df4:c140:1f:ffff:ffff:ffff:f0e6,2001:df4:c140:1f:ffff:ffff:ffff:f229,2001:df4:c140:1f:ffff:ffff:ffff:f340,2001:df4:c140:1f:ffff:ffff:ffff:f34b,2001:df4:c140:1f:ffff:ffff:ffff:f3ef,2001:df4:c140:1f:ffff:ffff:ffff:f4ba"
|
||||
RELAY_TIMEOUT_MS: "30000"
|
||||
RATE_LIMIT_MAX: "1000"
|
||||
|
||||
Reference in New Issue
Block a user