Skip to content

Commit d2c54ae

Browse files
committed
fix: styles
1 parent dad0111 commit d2c54ae

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/tools/atlas/metadata/connectCluster.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ export class ConnectClusterTool extends AtlasToolBase {
4747
}
4848

4949
private async prepareClusterConnection(projectId: string, clusterName: string): Promise<string> {
50-
await this.session.disconnect();
51-
5250
const cluster = await inspectCluster(this.session.apiClient, projectId, clusterName);
5351

5452
if (!cluster.connectionString) {
@@ -194,6 +192,11 @@ export class ConnectClusterTool extends AtlasToolBase {
194192
},
195193
],
196194
};
195+
case "connected-to-other-cluster":
196+
case "disconnected":
197+
default:
198+
// fall through to create new connection
199+
break;
197200
}
198201
} catch (err: unknown) {
199202
const error = err instanceof Error ? err : new Error(String(err));
@@ -205,6 +208,7 @@ export class ConnectClusterTool extends AtlasToolBase {
205208
// fall through to create new connection
206209
}
207210

211+
await this.session.disconnect();
208212
const connectionString = await this.prepareClusterConnection(projectId, clusterName);
209213
process.nextTick(async () => {
210214
try {

0 commit comments

Comments
 (0)