createPostgresRunStore().waitFor() starts a polling interval whose getRun(runId) rejection is not handled:
void getRun(runId).then((r) => {
if (r && isTerminal(r.status)) finish(r);
});
If Postgres is temporarily unavailable while a caller is waiting, the query rejects outside the returned waitFor promise. On current Node versions that is an unhandled rejection and can terminate the process instead of letting waitFor time out or report the database error normally.
The interval also leaves its timeout scheduled after finish, although it is unref'd.
Could the poll catch transient query failures (or reject waitFor deliberately) and clear both timers on settlement?
createPostgresRunStore().waitFor()starts a polling interval whosegetRun(runId)rejection is not handled:If Postgres is temporarily unavailable while a caller is waiting, the query rejects outside the returned
waitForpromise. On current Node versions that is an unhandled rejection and can terminate the process instead of lettingwaitFortime out or report the database error normally.The interval also leaves its timeout scheduled after
finish, although it is unref'd.Could the poll catch transient query failures (or reject
waitFordeliberately) and clear both timers on settlement?