-
-
Notifications
You must be signed in to change notification settings - Fork 129
Open
Labels
Description
Summary
If the server disconnects us; we will only know when the next select 1
runs:
client.query("select 1").catch(e => { |
We should catch this issue and reconnect earlier so we miss fewer events.
Steps to reproduce
- Set up a PostGraphile subscription.
- Terminate the PostgreSQL backend handling this subscription.
Expected results
pg-pubsub should reconnect quickly.
Actual results
pg-pubsub only notices when the next select 1
fails (up to 25 seconds later).
Possible Solution
client.on('error', () => {releaseClient(client); if (!pgPool.ending) setupClient()})