diff --git a/packages/services/tokens/src/index.ts b/packages/services/tokens/src/index.ts index 53234b875bb..ca564e08073 100644 --- a/packages/services/tokens/src/index.ts +++ b/packages/services/tokens/src/index.ts @@ -77,6 +77,10 @@ export async function main() { maxRetriesPerRequest: 20, db: 0, enableReadyCheck: false, + // Reject any command that doesn't get a reply within this window. Without it, a + // command sent on a half-open "ready" socket (e.g. after Redis becomes unavailable) can + // hang forever. + commandTimeout: 5_000, tls: env.redis.tlsEnabled ? {} : undefined, }); diff --git a/packages/services/usage/src/index.ts b/packages/services/usage/src/index.ts index 6dc5d21f865..0d41366f81f 100644 --- a/packages/services/usage/src/index.ts +++ b/packages/services/usage/src/index.ts @@ -59,6 +59,10 @@ async function main() { maxRetriesPerRequest: 20, db: 0, enableReadyCheck: false, + // Reject any command that doesn't get a reply within this window. Without it, a + // command sent on a half-open "ready" socket (e.g. after Redis becomes unavailable) can + // hang forever. + commandTimeout: 5_000, tls: env.redis.tlsEnabled ? {} : undefined, });