Skip to content

Commit de3fdb4

Browse files
committed
Setting a Default Request Timeout for REST API Calls
Signed-off-by: hfuss <[email protected]>
1 parent 2a4cbb1 commit de3fdb4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/lib/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ export const constants = {
3939
TRANSFER_HASH_ALGORITHM: 'sha256',
4040
REST_API_CALL_MAX_ATTEMPTS: 5,
4141
REST_API_CALL_RETRY_DELAY_MS: 500,
42+
REST_API_CALL_REQUEST_TIMEOUT: 1000,
4243
MAX_EVENT_QUEUE_SIZE: 1000,
4344
HASH_HEADER_NAME: 'dx-hash',
4445
LAST_UPDATE_HEADER_NAME: 'dx-last-update'
4546
};
46-
const log = new Logger('utils.ts')
47+
const log = new Logger('utils.ts');
48+
axios.defaults.timeout = constants.REST_API_CALL_REQUEST_TIMEOUT;
4749

4850
export const regexp = {
4951
FILE_KEY: /^(\/[a-z0-9\+\-\_\.]+)+$/i,

0 commit comments

Comments
 (0)