Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
update healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
alecananian committed Jun 28, 2024
1 parent fbc5ca5 commit d6a3964
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions app/routes/healthcheck.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import type { LoaderFunctionArgs } from "@remix-run/node";

export const loader = async ({ request }: LoaderFunctionArgs) => {
const host =
request.headers.get("X-Forwarded-Host") ?? request.headers.get("host");
import { getPairs } from "~/utils/pair.server";

export const loader = async () => {
try {
const url = new URL("/", `http://${host}`);
await fetch(url.toString(), { method: "HEAD" }).then((r) => {
if (!r.ok) return Promise.reject(r);
});
await getPairs();
return new Response("OK");
} catch (error: unknown) {
console.log("healthcheck ❌", { error });
} catch (err) {
console.error("Healthcheck failed:", err);
return new Response("ERROR", { status: 500 });
}
};

0 comments on commit d6a3964

Please sign in to comment.