From c28aae2740024dde88b4848020b22c0ecc5762fd Mon Sep 17 00:00:00 2001 From: CI Runner Date: Thu, 15 Oct 2026 01:30:06 +0100 Subject: [PATCH] fix(api): drain worker jobs before Prisma pool disconnect (BIT-31189) PM2 max_memory SIGINT was ending the Prisma/pg pool while archive and delivery jobs still queried it, flooding "Cannot use a pool after calling end". Await idle on all loop workers before $disconnect, and raise the worker memory/kill_timeout so burst indexing does not restart every few minutes. Paperclip-Agent: David Santos (urlKey founding-engineer; id 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376) Paperclip-Issue: BIT-31189 Paperclip-Run: 61448079-9293-4b3b-989d-b5857bf058c1 --- apps/api/src/archive/service.ts | 58 ++++++++++++++++++------------- apps/api/src/autopilot/service.ts | 11 ++++-- apps/api/src/delivery/service.ts | 11 ++++-- apps/api/src/develop/service.ts | 11 ++++-- apps/api/src/faces/service.ts | 11 ++++-- apps/api/src/ingest/scanner.ts | 9 +++-- apps/api/src/invoicing/service.ts | 11 ++++-- apps/api/src/lib/idle.ts | 17 +++++++++ apps/api/src/shop/service.ts | 11 ++++-- apps/api/src/sports/service.ts | 11 ++++-- apps/api/src/worker.ts | 26 +++++++++----- apps/api/test/idle.test.ts | 20 +++++++++++ infra/pm2/api.config.cjs | 7 ++-- 13 files changed, 163 insertions(+), 51 deletions(-) create mode 100644 apps/api/src/lib/idle.ts create mode 100644 apps/api/test/idle.test.ts diff --git a/apps/api/src/archive/service.ts b/apps/api/src/archive/service.ts index 003676c..87d90c2 100644 --- a/apps/api/src/archive/service.ts +++ b/apps/api/src/archive/service.ts @@ -11,6 +11,7 @@ import type { SecretBox } from "../delivery/secrets.js"; import type { CloudFolder, CloudSource } from "../generated/prisma/client.js"; import type { IngestLogger, IngestService } from "../ingest/service.js"; import { ingestWindow } from "../library/events.js"; +import { waitUntil } from "../lib/idle.js"; import { CloudClient, cleanBase, pollLogin, startLogin, type CloudEntry } from "./nextcloud.js"; import { describeFolder, type FolderGame, isInitials, isTeamName, lisbonDay, parseFolder, pickFixture } from "./match.js"; @@ -807,6 +808,7 @@ export class ArchiveWorker { private timer: NodeJS.Timeout | undefined; private stopped = false; private scanning = false; + private ticking = false; constructor( private readonly service: ArchiveService, @@ -827,33 +829,38 @@ export class ArchiveWorker { .then((n) => void (n && this.opts.log.info({ count: n }, "archive: re-queued images"))) .catch((err) => this.opts.log.warn({ err }, "archive: re-queue failed")); const tick = async () => { - await ready; + this.ticking = true; try { - if (!this.scanning) { - this.scanning = true; - // Walking runs beside the indexing (a big first walk should not hold the queue back). - void this.service - .scanDue() - .catch((err) => this.opts.log.warn({ err }, "archive: scan failed")) - .finally(() => { - this.scanning = false; + await ready; + try { + if (!this.scanning) { + this.scanning = true; + // Walking runs beside the indexing (a big first walk should not hold the queue back). + void this.service + .scanDue() + .catch((err) => this.opts.log.warn({ err }, "archive: scan failed")) + .finally(() => { + this.scanning = false; + }); + } + // Bulk work: less of it while the machine is busy with live games, all of it when quiet. + const burst = !!this.opts.burst && (await this.backlog()) > BURST_BACKLOG; + const full = burst ? this.opts.burst! : this.opts.concurrency; + const allowed = this.opts.pressure ? this.opts.pressure.allow(full, burst) : full; + const ids = await this.service.claim(allowed - this.inFlight); + for (const id of ids) { + this.inFlight++; + void this.service.index(id).finally(() => { + this.inFlight--; }); + } + } catch (err) { + this.opts.log.warn({ err }, "archive: poll failed"); } - // Bulk work: less of it while the machine is busy with live games, all of it when quiet. - const burst = !!this.opts.burst && (await this.backlog()) > BURST_BACKLOG; - const full = burst ? this.opts.burst! : this.opts.concurrency; - const allowed = this.opts.pressure ? this.opts.pressure.allow(full, burst) : full; - const ids = await this.service.claim(allowed - this.inFlight); - for (const id of ids) { - this.inFlight++; - void this.service.index(id).finally(() => { - this.inFlight--; - }); - } - } catch (err) { - this.opts.log.warn({ err }, "archive: poll failed"); + } finally { + this.ticking = false; + if (!this.stopped) this.timer = setTimeout(tick, this.opts.intervalMs); } - if (!this.stopped) this.timer = setTimeout(tick, this.opts.intervalMs); }; this.timer = setTimeout(tick, 0); } @@ -870,8 +877,11 @@ export class ArchiveWorker { return this.backlogCount; } - stop(): void { + /** Stop claiming work and wait for in-flight index/scan jobs before the DB pool is closed. */ + async stop(timeoutMs = 25_000): Promise { this.stopped = true; if (this.timer) clearTimeout(this.timer); + const drained = await waitUntil(() => !this.ticking && !this.scanning && this.inFlight === 0, { timeoutMs }); + if (!drained) this.opts.log.warn({ inFlight: this.inFlight, scanning: this.scanning }, "archive: stop timed out with work still running"); } } diff --git a/apps/api/src/autopilot/service.ts b/apps/api/src/autopilot/service.ts index 1806e41..385247c 100644 --- a/apps/api/src/autopilot/service.ts +++ b/apps/api/src/autopilot/service.ts @@ -7,6 +7,7 @@ import { type Box, compose, frameScore, minCropWidth, peopleIn } from "../compos import type { SubjectDetector } from "../composition/detect.js"; import { constrainRotated, tighter } from "../composition/geometry.js"; import type { IngestLogger } from "../ingest/service.js"; +import { waitUntil } from "../lib/idle.js"; import type { Broadcaster } from "../realtime.js"; import type { LocalStorage } from "../storage/storage.js"; import { CANDIDATE_SELECT, candidatesOf } from "./best.js"; @@ -274,6 +275,7 @@ export class AutopilotWorker { private timer: ReturnType | undefined; private inFlight = 0; private stopped = false; + private ticking = false; private lastDecide = 0; constructor( @@ -284,6 +286,7 @@ export class AutopilotWorker { start(): void { void this.service.requeueStale(); const tick = async () => { + this.ticking = true; try { const ids = await this.service.claim(this.opts.concurrency - this.inFlight); for (const id of ids) { @@ -298,14 +301,18 @@ export class AutopilotWorker { } } catch (err) { this.opts.log.warn({ err }, "autopilot: poll failed"); + } finally { + this.ticking = false; + if (!this.stopped) this.timer = setTimeout(tick, this.opts.intervalMs); } - if (!this.stopped) this.timer = setTimeout(tick, this.opts.intervalMs); }; this.timer = setTimeout(tick, 0); } - stop(): void { + async stop(timeoutMs = 25_000): Promise { this.stopped = true; if (this.timer) clearTimeout(this.timer); + const drained = await waitUntil(() => !this.ticking && this.inFlight === 0, { timeoutMs }); + if (!drained) this.opts.log.warn({ inFlight: this.inFlight }, "autopilot: stop timed out with work still running"); } } diff --git a/apps/api/src/delivery/service.ts b/apps/api/src/delivery/service.ts index 5778abd..da2388e 100644 --- a/apps/api/src/delivery/service.ts +++ b/apps/api/src/delivery/service.ts @@ -3,6 +3,7 @@ import { buildVars, createdStamp, eventName, PathTemplateError, renderFileName, import type { Db } from "../db.js"; import type { DeliveryItem } from "../generated/prisma/client.js"; import type { IngestLogger } from "../ingest/service.js"; +import { waitUntil } from "../lib/idle.js"; import { eventInfoOf } from "../library/event-info.js"; import { iptcForPhoto } from "../library/iptc.js"; import type { Broadcaster } from "../realtime.js"; @@ -407,6 +408,7 @@ export class DeliveryWorker { private inFlight = 0; private timer: NodeJS.Timeout | undefined; private stopped = false; + private ticking = false; constructor( private readonly service: DeliveryService, @@ -416,12 +418,15 @@ export class DeliveryWorker { start(): void { void this.service.requeueStale().then((n) => n && this.opts.log.info({ count: n }, "delivery: re-queued stale items")); const tick = async () => { + this.ticking = true; try { await this.fill(); } catch (err) { this.opts.log.warn({ err }, "delivery: poll failed"); + } finally { + this.ticking = false; + if (!this.stopped) this.timer = setTimeout(tick, this.opts.intervalMs); } - if (!this.stopped) this.timer = setTimeout(tick, this.opts.intervalMs); }; this.timer = setTimeout(tick, 0); } @@ -436,8 +441,10 @@ export class DeliveryWorker { } } - stop(): void { + async stop(timeoutMs = 25_000): Promise { this.stopped = true; if (this.timer) clearTimeout(this.timer); + const drained = await waitUntil(() => !this.ticking && this.inFlight === 0, { timeoutMs }); + if (!drained) this.opts.log.warn({ inFlight: this.inFlight }, "delivery: stop timed out with work still running"); } } diff --git a/apps/api/src/develop/service.ts b/apps/api/src/develop/service.ts index ee67d5d..dee8820 100644 --- a/apps/api/src/develop/service.ts +++ b/apps/api/src/develop/service.ts @@ -2,6 +2,7 @@ import { type DevelopState, type EditCommand, type EditLogEntry, type PostEdits, import type { Db } from "../db.js"; import { Prisma, type PhotoEdit } from "../generated/prisma/client.js"; import type { IngestLogger } from "../ingest/service.js"; +import { waitUntil } from "../lib/idle.js"; import { photoUrls } from "../library/serialize.js"; import type { Broadcaster } from "../realtime.js"; import { type LocalStorage, type UrlSigner, VARIANT_SIZE } from "../storage/storage.js"; @@ -198,6 +199,7 @@ export class RenderWorker { private inFlight = 0; private timer: NodeJS.Timeout | undefined; private stopped = false; + private ticking = false; constructor( private readonly service: DevelopService, @@ -207,6 +209,7 @@ export class RenderWorker { start(): void { void this.service.requeueStale(); const tick = async () => { + this.ticking = true; try { for (const id of await this.service.claimRenders(this.opts.concurrency - this.inFlight)) { this.inFlight++; @@ -216,14 +219,18 @@ export class RenderWorker { } } catch (err) { this.opts.log.warn({ err }, "develop: poll failed"); + } finally { + this.ticking = false; + if (!this.stopped) this.timer = setTimeout(tick, this.opts.intervalMs); } - if (!this.stopped) this.timer = setTimeout(tick, this.opts.intervalMs); }; this.timer = setTimeout(tick, 0); } - stop(): void { + async stop(timeoutMs = 25_000): Promise { this.stopped = true; if (this.timer) clearTimeout(this.timer); + const drained = await waitUntil(() => !this.ticking && this.inFlight === 0, { timeoutMs }); + if (!drained) this.opts.log.warn({ inFlight: this.inFlight }, "develop: stop timed out with work still running"); } } diff --git a/apps/api/src/faces/service.ts b/apps/api/src/faces/service.ts index 5a7f28f..148a01b 100644 --- a/apps/api/src/faces/service.ts +++ b/apps/api/src/faces/service.ts @@ -3,6 +3,7 @@ import type { Db } from "../db.js"; import { DEFAULT_CODE_LIST } from "../library/iptc.js"; import type { FaceGroup, Person } from "../generated/prisma/client.js"; import type { IngestLogger } from "../ingest/service.js"; +import { waitUntil } from "../lib/idle.js"; import type { Broadcaster } from "../realtime.js"; import type { LocalStorage } from "../storage/storage.js"; import { type Box, colourDistance, kitColour, numberBoxes, smallImage, torsoBox } from "../jersey/crop.js"; @@ -532,6 +533,7 @@ export class FaceWorker { private inFlight = 0; private timer: NodeJS.Timeout | undefined; private stopped = false; + private ticking = false; constructor( private readonly service: FaceService, @@ -542,6 +544,7 @@ export class FaceWorker { void this.service.requeueStale(); let missedAt = 0; const tick = async () => { + this.ticking = true; try { if (Date.now() - missedAt > 60_000) { missedAt = Date.now(); @@ -558,14 +561,18 @@ export class FaceWorker { } } catch (err) { this.opts.log.warn({ err }, "faces: poll failed"); + } finally { + this.ticking = false; + if (!this.stopped) this.timer = setTimeout(tick, this.opts.intervalMs); } - if (!this.stopped) this.timer = setTimeout(tick, this.opts.intervalMs); }; this.timer = setTimeout(tick, 0); } - stop(): void { + async stop(timeoutMs = 25_000): Promise { this.stopped = true; if (this.timer) clearTimeout(this.timer); + const drained = await waitUntil(() => !this.ticking && this.inFlight === 0, { timeoutMs }); + if (!drained) this.opts.log.warn({ inFlight: this.inFlight }, "faces: stop timed out with work still running"); } } diff --git a/apps/api/src/ingest/scanner.ts b/apps/api/src/ingest/scanner.ts index 17299e5..00deaa2 100644 --- a/apps/api/src/ingest/scanner.ts +++ b/apps/api/src/ingest/scanner.ts @@ -1,5 +1,6 @@ import { readdir, stat } from "node:fs/promises"; import path from "node:path"; +import { waitUntil } from "../lib/idle.js"; import type { IngestLogger, IngestService } from "./service.js"; interface Seen { @@ -17,6 +18,7 @@ export class IngestScanner { private readonly busy = new Set(); private timer: NodeJS.Timeout | undefined; private running = false; + private stopped = false; constructor( private readonly service: IngestService, @@ -36,13 +38,16 @@ export class IngestScanner { this.running = false; } } - this.timer = setTimeout(tick, this.opts.intervalMs); + if (!this.stopped) this.timer = setTimeout(tick, this.opts.intervalMs); }; this.timer = setTimeout(tick, 0); } - stop(): void { + async stop(timeoutMs = 25_000): Promise { + this.stopped = true; if (this.timer) clearTimeout(this.timer); + const drained = await waitUntil(() => !this.running && this.busy.size === 0, { timeoutMs }); + if (!drained) this.opts.log.warn({ busy: this.busy.size }, "ingest: stop timed out with work still running"); } private async *walk(dir: string): AsyncGenerator { diff --git a/apps/api/src/invoicing/service.ts b/apps/api/src/invoicing/service.ts index 53313ce..9edbde4 100644 --- a/apps/api/src/invoicing/service.ts +++ b/apps/api/src/invoicing/service.ts @@ -2,6 +2,7 @@ import type { Db } from "../db.js"; import type { SecretBox } from "../delivery/secrets.js"; import type { Invoice } from "../generated/prisma/client.js"; import type { IngestLogger } from "../ingest/service.js"; +import { waitUntil } from "../lib/idle.js"; import { lineNet } from "../shop/earnings.js"; import { periodOf, periodRange } from "../shop/press.js"; import { countryName, type DocumentInput, InvoiceXpress, InvoicingError } from "./invoicexpress.js"; @@ -201,6 +202,7 @@ export class InvoicingService { export class InvoicingWorker { private timer: NodeJS.Timeout | undefined; private stopped = false; + private ticking = false; private lastMonthly = 0; constructor( @@ -210,6 +212,7 @@ export class InvoicingWorker { start(): void { const tick = async () => { + this.ticking = true; try { // Monthly press invoices: checked every hour, created once per account and month. if (Date.now() - this.lastMonthly > 3600_000) { @@ -220,14 +223,18 @@ export class InvoicingWorker { for (const id of await this.invoicing.claim(5)) await this.invoicing.issue(id); } catch (err) { this.opts.log.warn({ err }, "invoicing: poll failed"); + } finally { + this.ticking = false; + if (!this.stopped) this.timer = setTimeout(tick, this.opts.intervalMs); } - if (!this.stopped) this.timer = setTimeout(tick, this.opts.intervalMs); }; this.timer = setTimeout(tick, 0); } - stop(): void { + async stop(timeoutMs = 25_000): Promise { this.stopped = true; if (this.timer) clearTimeout(this.timer); + const drained = await waitUntil(() => !this.ticking, { timeoutMs }); + if (!drained) this.opts.log.warn({}, "invoicing: stop timed out with work still running"); } } diff --git a/apps/api/src/lib/idle.ts b/apps/api/src/lib/idle.ts new file mode 100644 index 0000000..0e6f3a3 --- /dev/null +++ b/apps/api/src/lib/idle.ts @@ -0,0 +1,17 @@ +/** + * Wait until `ok()` is true, or until `timeoutMs` elapses. + * Used by worker shutdown to drain in-flight jobs before `$disconnect()` (BIT-31189). + */ +export async function waitUntil( + ok: () => boolean, + opts: { timeoutMs?: number; intervalMs?: number } = {}, +): Promise { + const timeoutMs = opts.timeoutMs ?? 25_000; + const intervalMs = opts.intervalMs ?? 50; + const deadline = Date.now() + timeoutMs; + while (!ok()) { + if (Date.now() >= deadline) return false; + await new Promise((r) => setTimeout(r, intervalMs)); + } + return true; +} diff --git a/apps/api/src/shop/service.ts b/apps/api/src/shop/service.ts index 01a5a10..c5d36ad 100644 --- a/apps/api/src/shop/service.ts +++ b/apps/api/src/shop/service.ts @@ -9,6 +9,7 @@ import type { SecretBox } from "../delivery/secrets.js"; import type { DevelopService } from "../develop/service.js"; import type { Event, Gallery, Order, OrderItem, Photo, Product, Site } from "../generated/prisma/client.js"; import type { IngestLogger } from "../ingest/service.js"; +import { waitUntil } from "../lib/idle.js"; import { codeListOf, iptcForPhoto, iptcOf } from "../library/iptc.js"; import type { LocalStorage, UrlSigner } from "../storage/storage.js"; import { EU, formatOrderNumber, priceOrder, splitVat } from "./pricing.js"; @@ -716,6 +717,7 @@ export class FulfilmentWorker { private timer: NodeJS.Timeout | undefined; private stopped = false; private inFlight = 0; + private ticking = false; constructor( private readonly shop: ShopService, @@ -725,6 +727,7 @@ export class FulfilmentWorker { start(): void { void this.shop.requeueStale(); const tick = async () => { + this.ticking = true; try { for (const id of await this.shop.claimDownloads(this.opts.concurrency - this.inFlight)) { this.inFlight++; @@ -734,14 +737,18 @@ export class FulfilmentWorker { } } catch (err) { this.opts.log.warn({ err }, "shop: poll failed"); + } finally { + this.ticking = false; + if (!this.stopped) this.timer = setTimeout(tick, this.opts.intervalMs); } - if (!this.stopped) this.timer = setTimeout(tick, this.opts.intervalMs); }; this.timer = setTimeout(tick, 0); } - stop(): void { + async stop(timeoutMs = 25_000): Promise { this.stopped = true; if (this.timer) clearTimeout(this.timer); + const drained = await waitUntil(() => !this.ticking && this.inFlight === 0, { timeoutMs }); + if (!drained) this.opts.log.warn({ inFlight: this.inFlight }, "shop: stop timed out with work still running"); } } diff --git a/apps/api/src/sports/service.ts b/apps/api/src/sports/service.ts index ca07dad..becb703 100644 --- a/apps/api/src/sports/service.ts +++ b/apps/api/src/sports/service.ts @@ -6,6 +6,7 @@ import type { SportsCompetition, SportsPlayer, SportsProvider } from "../generat import type { IngestLogger } from "../ingest/service.js"; import { DEFAULT_CODE_LIST } from "../library/iptc.js"; import { badRequest, notFound } from "../lib/errors.js"; +import { waitUntil } from "../lib/idle.js"; import type { LocalStorage } from "../storage/storage.js"; import { type CodeClash, type SquadForCodes, buildCodeLines, hasGeneratedBlock, mergeGenerated, slugify, toTsv } from "./codegen.js"; import { @@ -996,6 +997,7 @@ export class SportsService { export class SportsWorker { private timer: ReturnType | undefined; private stopped = false; + private ticking = false; private lastRefresh = 0; constructor( @@ -1005,6 +1007,7 @@ export class SportsWorker { start(): void { const tick = async () => { + this.ticking = true; try { if (Date.now() - this.lastRefresh >= (this.opts.refreshCheckMs ?? 10 * 60_000)) { this.lastRefresh = Date.now(); @@ -1013,14 +1016,18 @@ export class SportsWorker { await this.service.pollLineups(); } catch (err) { this.opts.log.warn({ err }, "sports: tick failed"); + } finally { + this.ticking = false; + if (!this.stopped) this.timer = setTimeout(tick, this.opts.lineupEveryMs ?? 5 * 60_000); } - if (!this.stopped) this.timer = setTimeout(tick, this.opts.lineupEveryMs ?? 5 * 60_000); }; this.timer = setTimeout(tick, 5_000); } - stop(): void { + async stop(timeoutMs = 25_000): Promise { this.stopped = true; if (this.timer) clearTimeout(this.timer); + const drained = await waitUntil(() => !this.ticking, { timeoutMs }); + if (!drained) this.opts.log.warn({}, "sports: stop timed out with work still running"); } } diff --git a/apps/api/src/worker.ts b/apps/api/src/worker.ts index 0f2b1ce..9cb4dfa 100644 --- a/apps/api/src/worker.ts +++ b/apps/api/src/worker.ts @@ -136,17 +136,25 @@ fulfilment.start(); invoices.start(); log.info({ ingestRoot: config.INGEST_ROOT, storage: config.STORAGE_ROOT }, "worker started"); +/** Drain in-flight jobs before ending the Prisma/pg pool (BIT-31189). Leave headroom under PM2 kill_timeout. */ +const DRAIN_MS = 25_000; +let shuttingDown = false; const shutdown = async (signal: string) => { + if (shuttingDown) return; + shuttingDown = true; log.info({ signal }, "worker stopping"); - scanner.stop(); - archive.stop(); - autopilot.stop(); - sports?.stop(); - deliveries.stop(); - faces?.stop(); - renders?.stop(); - fulfilment.stop(); - invoices.stop(); + // Stop claiming first, then wait for ticks/in-flight work so `$disconnect` does not race Prisma queries. + await Promise.all([ + scanner.stop(DRAIN_MS), + archive.stop(DRAIN_MS), + autopilot.stop(DRAIN_MS), + sports?.stop(DRAIN_MS) ?? Promise.resolve(), + deliveries.stop(DRAIN_MS), + faces?.stop(DRAIN_MS) ?? Promise.resolve(), + renders?.stop(DRAIN_MS) ?? Promise.resolve(), + fulfilment.stop(DRAIN_MS), + invoices.stop(DRAIN_MS), + ]); await faceEngine?.close(); await deliveryService.close(); await renderEngine?.close(); diff --git a/apps/api/test/idle.test.ts b/apps/api/test/idle.test.ts new file mode 100644 index 0000000..73e1184 --- /dev/null +++ b/apps/api/test/idle.test.ts @@ -0,0 +1,20 @@ +import { describe, expect, it } from "vitest"; +import { waitUntil } from "../src/lib/idle.js"; + +describe("waitUntil", () => { + it("resolves true when the predicate is already true", async () => { + expect(await waitUntil(() => true, { timeoutMs: 100 })).toBe(true); + }); + + it("waits until the predicate flips", async () => { + let ready = false; + setTimeout(() => { + ready = true; + }, 30); + expect(await waitUntil(() => ready, { timeoutMs: 500, intervalMs: 10 })).toBe(true); + }); + + it("returns false on timeout", async () => { + expect(await waitUntil(() => false, { timeoutMs: 40, intervalMs: 10 })).toBe(false); + }); +}); diff --git a/infra/pm2/api.config.cjs b/infra/pm2/api.config.cjs index 2baf921..ba44df1 100644 --- a/infra/pm2/api.config.cjs +++ b/infra/pm2/api.config.cjs @@ -35,8 +35,11 @@ module.exports = { node_args: "--env-file=.env", instances: 1, exec_mode: "fork", - max_memory_restart: "2G", - kill_timeout: 30000, + // Archive burst (many downloads + face processes) on 48-vCPU hosts routinely exceeds 2G; a too-low + // cap caused SIGINT restart loops and Prisma "pool after end" noise during unclean disconnect (BIT-31189). + max_memory_restart: "6G", + // Must exceed worker drain window (25s) so in-flight jobs finish before PM2 SIGKILLs. + kill_timeout: 45000, // Keep retrying with a growing pause (up to 15 s) instead of giving up after 15 quick crashes, e.g. while // the database container is still starting after a host reboot. exp_backoff_restart_delay: 200, -- 2.47.3