Skip to content

Deprecation Warning with pg@8: Concurrent client.query() Calls #15

Description

@dtillner

Description

When using graphql-postgres-subscriptions-retry with pg@8+, the following warning appears:

DeprecationWarning: Calling client.query() when the client is already executing a query is deprecated and will be removed in pg@9.0.

It happens during topic initialization in initTopics:

initTopics(triggers) {
    return Promise.all(triggers.map((eventName) => {
      return this.pgListen.listenTo(eventName);
    }));
}

Each listenTo() uses the same pg.Client, so running them in parallel triggers the warning.

Proposed Fix

Serialize the calls instead:

async initTopics(triggers) {
  for (const eventName of triggers) {
    await this.pgListen.listenTo(eventName);
  }
}

It would be great if someone could apply this small fix so the library is fully compatible with pg@8+ and ready for pg@9.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions