algoliasearch-client-javascript
algoliasearch-client-javascript copied to clipboard
Extremely large timeouts trigger immediately
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:
- calculate max timeout (using https://github.com/algolia/algoliasearch-client-javascript/blob/fec87a93f7642b3887507a836fb0b5800bdf56c2/packages/transporter/src/concerns/createRetryableOptions.ts#L41 with the largest number * 1000)
- when transporter gets created, error when timeout is larger than 2147483647/0x7FFFFFFF/2^31-1