File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -28,3 +28,5 @@ export const DEFAULT_API_VERSION = 'v1beta';
28
28
export const PACKAGE_VERSION = version ;
29
29
30
30
export const LANGUAGE_TAG = 'gl-js' ;
31
+
32
+ export const DEFAULT_FETCH_TIMEOUT_MS = 180 * 1000 ;
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import { ApiSettings } from '../types/internal';
21
21
import {
22
22
DEFAULT_API_VERSION ,
23
23
DEFAULT_BASE_URL ,
24
+ DEFAULT_FETCH_TIMEOUT_MS ,
24
25
LANGUAGE_TAG ,
25
26
PACKAGE_VERSION
26
27
} from '../constants' ;
@@ -145,9 +146,9 @@ export async function makeRequest(
145
146
) ;
146
147
// Timeout is 180s by default
147
148
const timeoutMillis =
148
- requestOptions ?. timeout !== undefined
149
+ requestOptions ?. timeout !== undefined && requestOptions . timeout >= 0
149
150
? requestOptions . timeout
150
- : 180 * 1000 ;
151
+ : DEFAULT_FETCH_TIMEOUT_MS ;
151
152
const abortController = new AbortController ( ) ;
152
153
fetchTimeoutId = setTimeout ( ( ) => abortController . abort ( ) , timeoutMillis ) ;
153
154
request . fetchOptions . signal = abortController . signal ;
You can’t perform that action at this time.
0 commit comments