fix(health): handle failed external probes
Build and Push Image / build-frontend (push) Failing after 19s
Build and Push Image / build-backend (push) Failing after 18s
Build and Push Image / push (push) Has been skipped

This commit is contained in:
2026-08-30 07:07:53 +00:00 Unverified
parent 061cce00dc
commit 988b0e2d35
+13 -10
View File
@@ -1,8 +1,9 @@
import { GoogleGenAI } from "@google/genai";
import { env } from "bun";
import { sql } from "drizzle-orm"; import { sql } from "drizzle-orm";
import { db } from "@/lib/db"; import { db } from "@/lib/db";
import { redis as redisShared } from "@/lib/db/redis"; import { redis as redisShared } from "@/lib/db/redis";
import { GoogleGenAI } from "@google/genai";
import { env } from "bun";
const { DISCORD_BOT_TOKEN, GEMINI_TTS_API_KEY } = env as Record<string, string>; const { DISCORD_BOT_TOKEN, GEMINI_TTS_API_KEY } = env as Record<string, string>;
const redis = redisShared!; const redis = redisShared!;
@@ -23,14 +24,16 @@ export async function GET() {
red red
? (await redis.exists(`health:${k}`)) ? (await redis.exists(`health:${k}`))
? (await redis.get(`health:${k}`)) === "ok" ? (await redis.get(`health:${k}`)) === "ok"
: await v().then(async (r: any) => { : await v()
const v = r instanceof Response ? r.ok : !!r; .then(async (r) => {
if (v) await redis.setex(`health:${k}`, 900, "ok"); const v = r instanceof Response ? r.ok : !!r;
return v; if (v) await redis.setex(`health:${k}`, 900, "ok");
}) return v;
: await v().then((r: any) => })
r instanceof Response ? r.ok : !!r, .catch(() => false)
), : await v()
.then((r) => (r instanceof Response ? r.ok : !!r))
.catch(() => false),
] as const, ] as const,
), ),
), ),