Skip to content

A backoff that returns undefined reconnects in a hot loop #31

Open

Description

@okomarov

A backoff function that returns undefined (or an explicit backoff: undefined option) gives a delay of NaN ms, which setTimeout treats as 1 ms. Against unreachable hosts that is a hot reconnect loop: the #23 review measured 349 connect attempts in one second against two refused hosts.

Fix: treat a non-finite or negative result as the default backoff, and an explicit undefined option as unset.

Activity

  1. moved this to Later in Roadmapon Oct 15, 2026
  2. added
    area: connections
    bug
    on Oct 16, 2026
  3. okomarov commented on Oct 18, 2026

    @okomarov
    Author

    Related, found while documenting backoff in #141: types/index.d.ts declares backoff: boolean | ((attemptNum: number) => number), but the runtime also takes a number of seconds (backoff is parsed as an integer from PGBACKOFF and ?backoff=), and true is used as 1 second. The fix here could settle the accepted values in the types too: a number or a function, with false for no delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: connectionsbug

    Type

    No type

    Projects

    • Status
      Later

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions