From 26cab4f0347af1eb836a675d42b1eff655d00041 Mon Sep 17 00:00:00 2001 From: Simon Zhu Date: Wed, 21 May 2025 21:41:34 -0400 Subject: [PATCH 1/3] fix terminated cluster states --- packages/compass-web/src/connection-storage.tsx | 16 ++++------------ packages/compass-web/src/entrypoint.tsx | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/packages/compass-web/src/connection-storage.tsx b/packages/compass-web/src/connection-storage.tsx index 64265b8cc2a..8c42fad9bac 100644 --- a/packages/compass-web/src/connection-storage.tsx +++ b/packages/compass-web/src/connection-storage.tsx @@ -207,10 +207,7 @@ export function buildConnectionInfoFromClusterDescription( const instanceSize = getInstanceSize(description); return { - // Cluster name is unique inside the project (hence using it in the backend - // urls as identifier) and using it as an id makes our job of mapping routes - // to compass state easier - id: description.name, + id: description.uniqueId, connectionOptions: { connectionString: connectionString.toString(), lookup: () => { @@ -265,7 +262,7 @@ export class AtlasCloudConnectionStorage implements ConnectionStorage { private loadAllPromise: Promise | undefined; - private canUseNewConnectionInfoEndpoint = true; + private useNewConnectionInfoEndpoint = true; constructor( private atlasService: AtlasService, private orgId: string, @@ -420,15 +417,10 @@ export class AtlasCloudConnectionStorage loadAll(): Promise { this.loadAllPromise ??= (async () => { - if (this.canUseNewConnectionInfoEndpoint === false) { - return this._loadAndNormalizeClusterDescriptionInfoV1(); - } - try { - return await this._loadAndNormalizeClusterDescriptionInfoV2(); - } catch (err) { - this.canUseNewConnectionInfoEndpoint = false; + if (this.useNewConnectionInfoEndpoint === false) { return this._loadAndNormalizeClusterDescriptionInfoV1(); } + return await this._loadAndNormalizeClusterDescriptionInfoV2(); })().finally(() => { delete this.loadAllPromise; }); diff --git a/packages/compass-web/src/entrypoint.tsx b/packages/compass-web/src/entrypoint.tsx index a3d835b5fac..4acae2e8d58 100644 --- a/packages/compass-web/src/entrypoint.tsx +++ b/packages/compass-web/src/entrypoint.tsx @@ -234,7 +234,7 @@ const WithConnectionsStore: React.FunctionComponent<{ useEffect(() => { const intervalId = setInterval(() => { void actions.refreshConnections(); - }, /* Matches default polling intervals in mms codebase */ 60_000); + }, /* Matches default polling intervals in mms codebase */ 5_000); return () => { clearInterval(intervalId); }; From 9435e933703e03ecdc0e2e8d910f6db2e1ef3996 Mon Sep 17 00:00:00 2001 From: Simon Zhu Date: Wed, 21 May 2025 21:45:29 -0400 Subject: [PATCH 2/3] fix terminated cluster states --- packages/compass-web/src/entrypoint.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/compass-web/src/entrypoint.tsx b/packages/compass-web/src/entrypoint.tsx index 4acae2e8d58..a3d835b5fac 100644 --- a/packages/compass-web/src/entrypoint.tsx +++ b/packages/compass-web/src/entrypoint.tsx @@ -234,7 +234,7 @@ const WithConnectionsStore: React.FunctionComponent<{ useEffect(() => { const intervalId = setInterval(() => { void actions.refreshConnections(); - }, /* Matches default polling intervals in mms codebase */ 5_000); + }, /* Matches default polling intervals in mms codebase */ 60_000); return () => { clearInterval(intervalId); }; From 6aa954abd4128531bf53eeff9e2aa34fb427e277 Mon Sep 17 00:00:00 2001 From: Simon Zhu Date: Wed, 21 May 2025 22:02:01 -0400 Subject: [PATCH 3/3] fix test --- packages/compass-web/src/connection-storage.spec.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/compass-web/src/connection-storage.spec.ts b/packages/compass-web/src/connection-storage.spec.ts index 6253b48add7..ca1568c21e5 100644 --- a/packages/compass-web/src/connection-storage.spec.ts +++ b/packages/compass-web/src/connection-storage.spec.ts @@ -166,7 +166,10 @@ describe('buildConnectionInfoFromClusterDescription', function () { deployment ); - expect(connectionInfo).to.have.property('id', clusterDescription.name); + expect(connectionInfo).to.have.property( + 'id', + clusterDescription.uniqueId + ); expect(connectionInfo).to.have.nested.property( 'connectionOptions.connectionString',