diff --git a/ts/textsecure/WebAPI.ts b/ts/textsecure/WebAPI.ts index ccbbbda98..4b398b239 100644 --- a/ts/textsecure/WebAPI.ts +++ b/ts/textsecure/WebAPI.ts @@ -57,11 +57,13 @@ import type { import { handleStatusCode, translateError } from './Utils'; import * as log from '../logging/log'; 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 // web request fails, because it will force it to text. But it is very useful for // debugging failed requests. const DEBUG = false; +const DEFAULT_TIMEOUT = 30 * SECOND; function _createRedactor( ...toReplace: ReadonlyArray @@ -231,7 +233,8 @@ async function _promiseAjax( const logId = `${options.type} ${logType} ${redactedURL}${unauthLabel}`; 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 cacheKey = `${proxyUrl}-${agentType}`; diff --git a/ts/textsecure/WebsocketResources.ts b/ts/textsecure/WebsocketResources.ts index b22046b98..5fdd60ee6 100644 --- a/ts/textsecure/WebsocketResources.ts +++ b/ts/textsecure/WebsocketResources.ts @@ -414,7 +414,7 @@ const STALE_THRESHOLD_MS = 5 * durations.MINUTE; // If we don't receive a response to keepalive request within 10 seconds - // close the socket. -const KEEPALIVE_TIMEOUT_MS = 10 * durations.SECOND; +const KEEPALIVE_TIMEOUT_MS = 30 * durations.SECOND; const LOG_KEEPALIVE_AFTER_MS = 500;