From c35805f887347041a98295a845a1c76ea262a381 Mon Sep 17 00:00:00 2001 From: Golda Velez Date: Thu, 10 Oct 2024 14:43:29 -0700 Subject: [PATCH] fix: for performance at scale, reduce timeouts to 10 seconds or less in all cases --- packages/cli/src/ipfs-connection-factory.ts | 2 +- packages/common/src/utils/fetch-json.ts | 2 +- packages/core/src/dispatcher.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/ipfs-connection-factory.ts b/packages/cli/src/ipfs-connection-factory.ts index cf4bfae95a..ed81804f80 100644 --- a/packages/cli/src/ipfs-connection-factory.ts +++ b/packages/cli/src/ipfs-connection-factory.ts @@ -6,7 +6,7 @@ import * as http from 'http' import * as https from 'https' import * as ipfs from '@ceramicnetwork/ipfs-daemon' -const IPFS_GET_TIMEOUT = 60000 // 1 minute +const IPFS_GET_TIMEOUT = 10000 // 10 seconds const mergeOptions = mergeOpts.bind({ ignoreUndefined: true }) diff --git a/packages/common/src/utils/fetch-json.ts b/packages/common/src/utils/fetch-json.ts index abe916b9c5..8f62df47d8 100644 --- a/packages/common/src/utils/fetch-json.ts +++ b/packages/common/src/utils/fetch-json.ts @@ -1,6 +1,6 @@ import { mergeAbortSignals, TimedAbortSignal, abortable } from './abort-signal-utils.js' -const DEFAULT_FETCH_TIMEOUT = 60 * 1000 * 3 // 3 minutes +const DEFAULT_FETCH_TIMEOUT = 10 * 1000 // 10 seconds export type FetchOpts = Partial<{ body: any diff --git a/packages/core/src/dispatcher.ts b/packages/core/src/dispatcher.ts index c2cef4518d..766b3856d5 100644 --- a/packages/core/src/dispatcher.ts +++ b/packages/core/src/dispatcher.ts @@ -36,7 +36,7 @@ import { IReconApi } from './recon.js' import { NodeMetrics } from '@ceramicnetwork/node-metrics' const IPFS_GET_RETRIES = 3 -const DEFAULT_IPFS_GET_SYNC_TIMEOUT = 30000 // 30 seconds per retry, 3 retries = 90 seconds total timeout +const DEFAULT_IPFS_GET_SYNC_TIMEOUT = 2000 // 2 seconds per retry, 3 retries = 6 seconds total timeout const DEFAULT_IPFS_GET_LOCAL_TIMEOUT = 1000 // 1 second to get data from local ipfs store const IPFS_MAX_COMMIT_SIZE = 256000 // 256 KB const IPFS_RESUBSCRIBE_INTERVAL_DELAY = 1000 * 15 // 15 sec