Skip to content

Make the auto-reconnect backoff configurable in the TypeScript SDK #5526

Description

@DexterKoelson

The connection manager retries dropped connections with an exponential backoff that is fixed at module-level constants.
They are hard coded to start at 1000ms and maxes out at 30_000ms.

There is no way for an app to tune these. Apps that want faster recovery, or a gentler backoff, currently cannot change them. I for one require different values as my player base is 95% mobile browser in flaky connections areas.

Proposal: let the delays be set on the builder, e.g.

DbConnection.builder()
  .withUri(...)
  .withDatabaseName(...)
  .withReconnectOptions({ baseDelayMs: 500, maxDelayMs: 10_000 })

Open question for maintainers: field naming. The linked PR uses baseDelayMs / maxDelayMs to match the existing constant names, with baseDelayMs documented as the minimum (first-retry) delay. minDelayMs / maxDelayMs may read better for consumers. Happy to rename.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions