WebAPI: Increase default timeout to 30 seconds
This commit is contained in:
parent
28870655e6
commit
7c5e6166ab
2 changed files with 5 additions and 2 deletions
|
@ -57,11 +57,13 @@ import type {
|
||||||
import { handleStatusCode, translateError } from './Utils';
|
import { handleStatusCode, translateError } from './Utils';
|
||||||
import * as log from '../logging/log';
|
import * as log from '../logging/log';
|
||||||
import { maybeParseUrl, urlPathFromComponents } from '../util/url';
|
import { maybeParseUrl, urlPathFromComponents } from '../util/url';
|
||||||
|
import { SECOND } from '../util/durations';
|
||||||
|
|
||||||
// Note: this will break some code that expects to be able to use err.response when a
|
// Note: this will break some code that expects to be able to use err.response when a
|
||||||
// web request fails, because it will force it to text. But it is very useful for
|
// web request fails, because it will force it to text. But it is very useful for
|
||||||
// debugging failed requests.
|
// debugging failed requests.
|
||||||
const DEBUG = false;
|
const DEBUG = false;
|
||||||
|
const DEFAULT_TIMEOUT = 30 * SECOND;
|
||||||
|
|
||||||
function _createRedactor(
|
function _createRedactor(
|
||||||
...toReplace: ReadonlyArray<string | undefined>
|
...toReplace: ReadonlyArray<string | undefined>
|
||||||
|
@ -231,7 +233,8 @@ async function _promiseAjax(
|
||||||
const logId = `${options.type} ${logType} ${redactedURL}${unauthLabel}`;
|
const logId = `${options.type} ${logType} ${redactedURL}${unauthLabel}`;
|
||||||
log.info(logId);
|
log.info(logId);
|
||||||
|
|
||||||
const timeout = typeof options.timeout === 'number' ? options.timeout : 10000;
|
const timeout =
|
||||||
|
typeof options.timeout === 'number' ? options.timeout : DEFAULT_TIMEOUT;
|
||||||
|
|
||||||
const agentType = options.unauthenticated ? 'unauth' : 'auth';
|
const agentType = options.unauthenticated ? 'unauth' : 'auth';
|
||||||
const cacheKey = `${proxyUrl}-${agentType}`;
|
const cacheKey = `${proxyUrl}-${agentType}`;
|
||||||
|
|
|
@ -414,7 +414,7 @@ const STALE_THRESHOLD_MS = 5 * durations.MINUTE;
|
||||||
|
|
||||||
// If we don't receive a response to keepalive request within 10 seconds -
|
// If we don't receive a response to keepalive request within 10 seconds -
|
||||||
// close the socket.
|
// close the socket.
|
||||||
const KEEPALIVE_TIMEOUT_MS = 10 * durations.SECOND;
|
const KEEPALIVE_TIMEOUT_MS = 30 * durations.SECOND;
|
||||||
|
|
||||||
const LOG_KEEPALIVE_AFTER_MS = 500;
|
const LOG_KEEPALIVE_AFTER_MS = 500;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue