Optionalopts: FlushOptionsimport { flushAllDetached } from 'footprintjs/detach';
process.on('SIGTERM', async () => {
const stats = await flushAllDetached({ timeoutMs: 10_000 });
console.log(`Drained ${stats.done} done, ${stats.failed} failed, ${stats.pending} pending.`);
process.exit(stats.pending === 0 ? 0 : 1);
});
Wait for every in-flight detached handle to reach a terminal state. Returns counts for diagnostics. PROCESS-WIDE — drains every driver across every executor. For per-executor scoping, consumers should collect their own handles from
executor.detachAndJoinLater(...)calls and awaitPromise.allSettled([...].map(h => h.wait()))themselves.