From 580473d713d25838b0a5861b81b8e09cd1af366d Mon Sep 17 00:00:00 2001 From: Roland Schlaefli Date: Fri, 10 Jul 2026 11:40:42 +0200 Subject: [PATCH] fix(egress-ledger): reconnect redis indefinitely so egress-gateway self-heals The egress-ledger redis client used retryStrategy returning null after 5 attempts, which puts ioredis into the terminal "end" state and stops all reconnection. If redis is briefly unreachable at startup (e.g. a transient network/policy blip), the cached singleton gives up for good; the readiness probe (/ready -> pingEgressLedger -> ping) then fails forever while /live keeps returning 200, so the pod is never restarted and never recovers. Match the capped-backoff, never-give-up strategy already used by file-server.ts and tool-call-server.ts so the client self-heals once redis becomes reachable again. --- service/src/egress-ledger.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/service/src/egress-ledger.ts b/service/src/egress-ledger.ts index 24dda87..c190897 100644 --- a/service/src/egress-ledger.ts +++ b/service/src/egress-ledger.ts @@ -58,10 +58,13 @@ function ttlSeconds(exp: number): number { function redisConnection(): IORedis { if (redis) return redis; - const retryStrategy: CommonRedisOptions['retryStrategy'] = times => { - if (times > 5) return null; - return 2000; - }; + // Retry indefinitely with capped backoff (matching file-server / tool-call-server) + // so a transient outage never leaves this singleton permanently disconnected. The + // previous strategy returned null after 5 attempts, which put ioredis into the "end" + // state for good; the readiness probe (/ready -> pingEgressLedger) then failed + // forever while /live kept returning 200, so the pod never restarted to recover. + const retryStrategy: CommonRedisOptions['retryStrategy'] = times => + Math.min(times * 500, 2000); redis = new IORedis({ host: process.env.REDIS_HOST ?? 'redis', port: Number(process.env.REDIS_PORT) || 6379,