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), });