Skip to content

Handle PostgreSQL poll failures in run waitFor #57

Description

@Mr-Neutr0n

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions