fix(api): add timeouts for OIDC discovery fetch and DB connection
- OIDC discovery fetch in initAuth() now has a 5s AbortSignal.timeout to fail fast instead of hanging indefinitely when the auth server is unreachable. This was identified as a root cause of startup ECONNRESET crashes on UAT where ztunnel drops TCP connections before headers arrive. - DB postgres client now sets connect_timeout: 5 so failed connection attempts fail fast rather than hanging the startup sequence. - Graceful shutdown timeout tightened to 8s (from 10s) to avoid getting killed by Kubernetes liveness-probe deadline while draining. Fixes GRO-1678. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -12,7 +12,7 @@ export function getDb() {
|
||||
if (_db) return _db;
|
||||
const url = process.env.DATABASE_URL;
|
||||
if (!url) throw new Error("DATABASE_URL is not set");
|
||||
const client = postgres(url, { max: 10 });
|
||||
const client = postgres(url, { max: 10, connect_timeout: 5 });
|
||||
_db = drizzle(client, { schema });
|
||||
return _db;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user