Skip to content

TypeScript consumer: use PgQue LISTEN/NOTIFY wakeups instead of poll-only 30s latency #147

@NikolayS

Description

@NikolayS

Problem

The TypeScript high-level Consumer ignores PgQue's existing LISTEN/NOTIFY wakeup path and only sleeps/polls.

SQL pgque.ticker(queue) emits:

pg_notify('pgque_' || queue_name, tick_id::text)

Python Consumer uses LISTEN pgque_<queue> and wakes on notify. TypeScript Consumer defaults to pollInterval = 30_000, so a message can sit for up to ~30s after a tick even though the database emitted a notification.

Go also currently polls only, so this may be a broader parity decision, but TS is especially visible because the Node pg driver supports notifications.

Why this matters

PgQue docs/positioning imply low-latency delivery with ticker cadence. Poll-only 30s default makes the driver feel sluggish and inconsistent with Python.

Suggested fix

  • Add LISTEN/NOTIFY support to TS Consumer using a dedicated connection/client.
  • Keep polling as fallback / safety net.
  • Consider doing the same in Go or document why Go intentionally remains poll-only.
  • Tests should simulate/verify wake-up without waiting for full poll interval.

Acceptance criteria

  • TS Consumer wakes promptly on pgque_<queue> notify.
  • README documents latency behavior.
  • Cross-driver docs explain whether each Consumer uses LISTEN, polling, or both.

Metadata

Metadata

Assignees

No one assigned

    Labels

    engineerOwned by an engineer agent (do work, open PR)enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions