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()})
Summary
If the server disconnects us; we will only know when the next
select 1runs:graphile-engine/packages/pg-pubsub/src/index.ts
Line 181 in 9940895
We should catch this issue and reconnect earlier so we miss fewer events.
Steps to reproduce
Expected results
pg-pubsub should reconnect quickly.
Actual results
pg-pubsub only notices when the next
select 1fails (up to 25 seconds later).Possible Solution
client.on('error', () => {releaseClient(client); if (!pgPool.ending) setupClient()})