INNER CODE UNIT · TypeScript
Promise
PerryTS/perry · example-code/forgejo-deployment/main.ts:130
await new Promise((r) => setTimeout(r, 1000));
}
}
console.error(` pg_isready never succeeded after ${attempt} attempts`);
return false;
}
async function waitForForgejo(stack: number, timeoutMs: number): Promise<boolean> {
const deadline = Date.now() + timeoutMs;
let attempt = 0;
while (Date.now() < deadline) {
attempt++;
try {
// Forgejo's `/api/healthz` is a no-auth liveness endpoint that
// returns 200 with a pass/fail JSON body once the web server is
// up AND the database / cache subsystems pinged successfully.
// (`/api/v1/version` is auth-gated when `REQUIRE_SIGNIN_VIEW` is
// on, which would make `wget` exit 8 on HTTP 401.)