fix(importer): add query-level timeout to prevent indefinite hangs on dead connections (#1419)
Commit: 470ad33b334336d834562ae73c5694a373595895
Date: 2026-07-04 15:12:32 +0000
Author: PascalHavelange
Commit Message
fix(importer): add query-level timeout to prevent indefinite hangs on dead connections (#1419)
LegacyDatabase and ResilientConnection both attach their own 'error' listener
to the raw mysql2 Connection for reconnect handling. Confirmed in practice:
when the legacy DB connection drops mid-query, that error can be fully
consumed by the listener without ever rejecting the specific in-flight
query's own promise -- so `await connection.execute(...)` hangs forever, and
the existing retry-with-backoff loops in query()/execute() never get a
chance to run at all. Reproduced twice in a row at the identical point in a
`stage` run (Travels Monument Translations) after two consecutive connection
drops: 0% CPU, no further output, indefinitely.
Races every execute() call against a 30s timeout instead, turning a silent
hang into a retryable error the existing reconnect-and-retry logic already
knows how to handle. Verified: a subsequent `stage` run against the real
legacy DB completed successfully end-to-end, producing identical row/image
counts to the last fully-completed run (27813 items, 54773 translations,
28642 staged images).
Co-authored-by: Pascal HAVELANGE <havelangep@hotmail.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Files Changed
- 📝 Modified:
scripts/importer/src/cli/import.ts
Links
This documentation was automatically generated from Git commit data.