From 0ad09111a75f9b3671c9bc94bf6c42e6c2ea6971 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 9 Oct 2026 22:58:00 -0700 Subject: [PATCH] perf(search): search up to eight live accounts at once A live search waits for every account before fusing results, and accounts ran four at a time, so an organization with five to eight connected accounts paid a second full provider round trip on every unscoped search. Production seven-account searches took about 2.1 s at p50 against about 0.6 s for one account. Each account is a single provider call, so eight at once stays well inside provider and token-refresh limits. --- apps/sim/lib/sim-search/live/application.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/sim/lib/sim-search/live/application.ts b/apps/sim/lib/sim-search/live/application.ts index 3eb7f8e96b6..912d8d5281d 100644 --- a/apps/sim/lib/sim-search/live/application.ts +++ b/apps/sim/lib/sim-search/live/application.ts @@ -261,8 +261,12 @@ function resultFor( } } -/** Accounts searched at once; bounds token refresh and provider fan-out in large organizations. */ -const ACCOUNT_CONCURRENCY = 4 +/** + * Accounts searched at once; bounds token refresh and provider fan-out in large organizations. + * Each account is one provider, and a search waits for every account, so a second wave adds a + * full provider round trip; eight covers the account count most organizations search. + */ +const ACCOUNT_CONCURRENCY = 8 /** Candidates verified at once; each verification is one or more provider requests. */ const VERIFY_CONCURRENCY = 5 const MAX_ACCOUNTS = 20