import type { Pool } from 'pg'; import type { CleanupResult, JobMaintenance, RecoveredJob } from '../services/ports/jobMaintenance.js'; export interface PgJobMaintenanceOptions { /** How long an interrupted job is kept, by the database clock (§ 8.4, Cleanup). */ retentionMs?: number; } /** * What the cron jobs do to the jobs, in PostgreSQL (§ 8.4). It takes the pool as * an argument, so a test can point it anywhere. Every method is a statement or * two that can run on every instance at the same time: the recovery locks the * rows it takes with `SKIP LOCKED`, so two instances never take the same job, * and a row a live worker is writing at that moment is left for the next round. * Times are the database's `now()`. */ export declare class PgJobMaintenance implements JobMaintenance { private readonly pool; private readonly retentionMs; constructor(pool: Pool, options?: PgJobMaintenanceOptions); recoverDead(deadAfterMs: number, message: string): Promise; waitingForWorker(quietMs: number): Promise; cleanUp(uploadIdleMs: number): Promise; }