Skip to content

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

Open
@benjie

Description

@benjie

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()})

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions