From 1c686a57257e4cc5fb65fa8f9e38a42e9d64d50f Mon Sep 17 00:00:00 2001 From: Bob Qiu Date: Tue, 29 Sep 2026 16:34:18 +0800 Subject: [PATCH] revert: drop lock-acquire timeout and team-projects fetch timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both were speculative fixes for the "Create project" dialog hang, based on a lock-contention/slow-network hypothesis later disproven by CI timing diagnostics (see 36ea5dce6) — the actual bug was ProjectModal's close effect, now fixed separately. Keeping them isn't just unnecessary, it's a regression risk: the 15s lock-acquire timeout would fire against runKonnectOrgMigration (src/konnect/migrate-konnect-organization.ts), which holds projectLock for a synchronous loop over every migratable project and can legitimately run past 15s for accounts with many projects — turning a previously-fine "wait it out" into a spurious "Timed out waiting for another project operation to finish" error on project creation. Co-Authored-By: Claude Sonnet 5 --- packages/insomnia-api/src/project.ts | 3 +-- .../node-src/services/project.ts | 9 +------- packages/insomnia/src/common/project.ts | 22 ++----------------- 3 files changed, 4 insertions(+), 30 deletions(-) diff --git a/packages/insomnia-api/src/project.ts b/packages/insomnia-api/src/project.ts index 8ffca29eea..1d732f48c2 100644 --- a/packages/insomnia-api/src/project.ts +++ b/packages/insomnia-api/src/project.ts @@ -7,12 +7,11 @@ interface TeamProjects { }[]; } -export const fetchTeamProjects = ({ sessionId, organizationId, timeout }: { sessionId: string; organizationId: string; timeout?: number }) => { +export const fetchTeamProjects = ({ sessionId, organizationId }: { sessionId: string; organizationId: string }) => { return fetch({ method: 'GET', path: `/v1/organizations/${organizationId}/team-projects`, sessionId, - timeout, }); }; diff --git a/packages/insomnia-data/node-src/services/project.ts b/packages/insomnia-data/node-src/services/project.ts index 5567ca0054..3a0f268aee 100644 --- a/packages/insomnia-data/node-src/services/project.ts +++ b/packages/insomnia-data/node-src/services/project.ts @@ -67,13 +67,6 @@ export async function getFirstProjectOfOrganization(organizationId: string) { return db.findOne(type, { parentId: organizationId }); } -// syncProjects() runs this in the background under the same lock that -// guards interactive project creation (see `projectLock` in -// packages/insomnia/src/common/project.ts), so it must not be allowed to -// hold that lock for as long as the default fetch timeout (30s) — that -// blocks a user's "Create project" action for far longer than they'd wait. -const TEAM_PROJECTS_FETCH_TIMEOUT_MS = 8000; - export async function getAllTeamProjects(organizationId: string) { const { id: sessionId } = await userSessionService.get(); if (!sessionId) { @@ -81,7 +74,7 @@ export async function getAllTeamProjects(organizationId: string) { } console.log('[project] Fetching', organizationId); - const response = await fetchTeamProjects({ sessionId, organizationId, timeout: TEAM_PROJECTS_FETCH_TIMEOUT_MS }); + const response = await fetchTeamProjects({ sessionId, organizationId }); return response.data; } diff --git a/packages/insomnia/src/common/project.ts b/packages/insomnia/src/common/project.ts index 18c48c953d..e28381cd08 100644 --- a/packages/insomnia/src/common/project.ts +++ b/packages/insomnia/src/common/project.ts @@ -39,12 +39,6 @@ export interface InsomniaFile { }; } -// How long a caller will wait in queue for the lock before giving up. Without -// this, a slow or stuck lock holder (e.g. a background project sync) blocks -// every other queued operation (e.g. creating a project) indefinitely, with -// no error surfaced to the user. -const LOCK_ACQUIRE_TIMEOUT_MS = 15_000; - const lockGenerator = () => { // Simple mutex lock implementation let isLocked = false; @@ -57,20 +51,8 @@ const lockGenerator = () => { } // If already locked, wait in queue - return new Promise((resolve, reject) => { - const timer = setTimeout(() => { - const index = lockQueue.indexOf(onUnlocked); - if (index !== -1) { - lockQueue.splice(index, 1); - } - reject(new Error('Timed out waiting for another project operation to finish. Please try again.')); - }, LOCK_ACQUIRE_TIMEOUT_MS); - - const onUnlocked = () => { - clearTimeout(timer); - resolve(); - }; - lockQueue.push(onUnlocked); + return new Promise(resolve => { + lockQueue.push(resolve); }); };