Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pg-pubsub should subscribe to listeningClient.on('error') #723

Open
benjie opened this issue Mar 18, 2021 · 0 comments
Open

pg-pubsub should subscribe to listeningClient.on('error') #723

benjie opened this issue Mar 18, 2021 · 0 comments
Labels

Comments

@benjie
Copy link
Member

benjie commented Mar 18, 2021

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

  1. Set up a PostGraphile subscription.
  2. 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()})

@benjie benjie added the bug label Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant