UNPKG

@accounter/server

Version:
21 lines (20 loc) 747 B
import type { Pool } from 'pg'; export interface PoolMonitorOptions { pool: Pool; /** Emit a heartbeat this often. */ intervalMs: number; /** Pool size, for saturation reporting. */ max: number; } /** * Periodic health heartbeat for the Postgres pool. * * The failure this exists for is silent by construction: an exhausted pool * produces no error, no CPU, and no log line — requests simply queue in * `pool.connect()` forever. `waiting > 0` alongside `idle === 0` is that state, * visible in a single line, and the heartbeat continuing to print at all is * proof the event loop is still turning. */ export declare function startPoolMonitor({ pool, intervalMs, max }: PoolMonitorOptions): { stop: () => void; };