From 1492c0a4426b18b128642ec00083571c248ab586 Mon Sep 17 00:00:00 2001 From: dmgnr Date: Mon, 21 Sep 2026 18:02:38 +0000 Subject: [PATCH] fix(redis): maximize retry window --- app/api/health/route.ts | 2 +- lib/db/redis.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/api/health/route.ts b/app/api/health/route.ts index 2983aaa..41423c2 100755 --- a/app/api/health/route.ts +++ b/app/api/health/route.ts @@ -40,7 +40,7 @@ export async function GET() { ); return Response.json( { red, ...res }, - { status: red ? (res.database ? 200 : 201) : 503 }, + { status: res.database && red ? 200 : 201 }, ); } diff --git a/lib/db/redis.ts b/lib/db/redis.ts index 043036f..a57615e 100755 --- a/lib/db/redis.ts +++ b/lib/db/redis.ts @@ -1,7 +1,10 @@ import ReconnectingEventSource from "reconnecting-eventsource"; import type z from "zod"; -export const redis = typeof Bun !== "undefined" ? Bun.redis : null; +export const redis = + typeof Bun !== "undefined" + ? new Bun.RedisClient(undefined, { maxRetries: 4294967295 }) + : null; type PubPayload = { event?: string; data: unknown }; @@ -126,7 +129,7 @@ export class EventSourceEndpoint { throw new Error( "EventSourceEndpoint.pub(...) can only be called on the server.", ); - return this.manager.publish(this.eventMap[event].parse(data), { + this.manager.publish(this.eventMap[event].parse(data), { topic: this.endpoint, event: String(event), });