Skip to content

Extremely large timeouts trigger immediately #1271

Closed
@Haroenv

Description

@Haroenv

see: https://stackoverflow.com/questions/3468607/why-does-settimeout-break-for-large-millisecond-delay-values

approximate reproduction:

  const client = getAlgoliaClient(applicationData, {
    queryParameters: userId ? { 'X-Algolia-UserID': userId } : undefined,
    timeouts: {
      connect: 2,
      read: 3600000,
      write: 3600000,
    },
  });

solution:

  1. calculate max timeout (using
    getTimeout(timeoutsCount: number, baseTimeout: number): number {
    with the largest number * 1000)
  2. when transporter gets created, error when timeout is larger than 2147483647/0x7FFFFFFF/2^31-1

Metadata

Metadata

Assignees

No one assigned

    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