Skip to content

Commit 0479bca

Browse files
fix(http): Long https requests would be cancelled
If we had a long http request it would be cancelled potentially even before the given timeout. This is because there was ANOTHER timeout that is specifically in getResponseFromGetRequest(). SOLUTION: This other timeout was intended to be used for retries, and to set an upper limit in time for retrying. It was very low (3 seconds) so we bump it to a larger time instead to be safe. In general, the user provided Timeout object should be used instead to set the expected upper limit. The one this commit changes is the "backup" upper limit. Signed-off-by: nkomonen-amazon <[email protected]>
1 parent 6e97d56 commit 0479bca

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/core/src/shared/resourcefetcher/httpResourceFetcher.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { ResourceFetcher } from './resourcefetcher'
99
import { Timeout, CancelEvent, waitUntil } from '../utilities/timeoutUtils'
1010
import request, { RequestError } from '../request'
1111
import { isUserCancelledError } from '../errors'
12+
import { oneMinute } from '../datetime'
1213

1314
type RequestHeaders = { eTag?: string; gZip?: boolean }
1415

@@ -117,8 +118,10 @@ export class HttpResourceFetcher implements ResourceFetcher<Response> {
117118
return req.response.finally(() => cancelListener?.dispose())
118119
},
119120
{
120-
timeout: 3000,
121-
interval: 100,
121+
// Ensures we don't abort a long request (eg: slow connection).
122+
// This timeout is just backup, the given Timeout object should be relied on instead.
123+
timeout: oneMinute * 30,
124+
interval: 500,
122125
backoff: 2,
123126
retryOnFail: (error: Error) => {
124127
// Retry unless the user intentionally canceled the operation.

0 commit comments

Comments
 (0)