Open
Description
Summary
If the server disconnects us; we will only know when the next select 1
runs:
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()})