Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
fixes #9643
When the DB disconnects, it's nice to reconnect it.
This is a ridiculously hard problem as it turns out:
brianc/node-postgres#1324
brianc/node-postgres#2112
Depending on when & how the disconnect happens, the client may not be aware of it.
For example:
terminating connection due to administrator command
then the PG client reports the errorConnection terminated unexpectedly
and the app gets killed. I think it gets killed because it's aProcessInterrupts
routine coming frompostgres.c
and the severity isFATAL
.the database system is shutting down
then it reconnects just as expected. This is what we've seen coming from Google CloudSQL.econnrefused
. I'm ignoring this case in this PR.Demo
start up the embedder & then kill the PG container in docker. sometimes you get case 1, sometimes case 2.