Skip to content

CONNECTION_CLOSED on subscribe() #757

@dvv

Description

@dvv

I use standard

const { unsubscribe: _unsubscribe } = await sql.subscribe(
  "*",
  (row, info) => {
    console.log("SUB", row, info)
  },
  () => {
    console.log("SUB!")
  },
)

and it works well.

When postgres goes down I immediately get

Unexpected error during logical streaming - reconnecting Error: write CONNECTION_CLOSED ...
    at closed (https://deno.land/x/postgresjs@v3.4.2/src/connection.js:443:57)
    at https://deno.land/x/postgresjs@v3.4.2/polyfills.js:138:30
    at Array.forEach (<anonymous>)
    at call (https://deno.land/x/postgresjs@v3.4.2/polyfills.js:138:16)
    at closed (https://deno.land/x/postgresjs@v3.4.2/polyfills.js:127:5)
    at success (https://deno.land/x/postgresjs@v3.4.2/polyfills.js:109:7)
    at eventLoopTick (ext:core/01_core.js:189:11) {
  code: "CONNECTION_CLOSED",
  errno: "CONNECTION_CLOSED",

When postgres goes up then I get everything working except for the above subscription -- it never reconnects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions