Repository Public
1/** Child process of the soak test: a plain worker; SIGTERM = graceful stop. It is SIGKILLed at random by the test. */2import pg from 'pg';3import { createKernel, runWorkerLoop } from '../../src/index.js';4import { makeSoakLogic } from './soak-logic.js';56const k = createKernel({ databaseUrl: process.env.DATABASE_URL, poolMax: 6 });7const tripPool = new pg.Pool({ connectionString: process.env.DATABASE_URL, max: 4 });8tripPool.on('error', () => undefined);9const ac = new AbortController();10process.on('SIGTERM', () => ac.abort());1112await runWorkerLoop({13 kernel: k,14 logic: makeSoakLogic(tripPool),15 signal: ac.signal,16 concurrency: 3,17 leaseMs: Number(process.env.LEASE_MS ?? 2500),18 heartbeatMs: 300,19 pollMs: 50,20 janitorMs: false,21 dailyBudgetUsd: null,22 workerId: `soak-${process.env.SLOT}-${process.pid}`,23});24await tripPool.end();25await k.close();26process.exit(0);27