Skip to content

Commit a6efc47

Browse files
committed
chore: propagate connected atlas cluster when disconnecting
1 parent 693c755 commit a6efc47

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/common/connectionManager.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,14 @@ export class ConnectionManager extends EventEmitter<ConnectionManagerEvents> {
141141
try {
142142
await this.state.serviceProvider?.close(true);
143143
} finally {
144-
this.changeState("connection-closed", { tag: "disconnected" });
144+
this.changeState("connection-closed", {
145+
tag: "disconnected",
146+
connectedAtlasCluster: this.state.connectedAtlasCluster,
147+
});
145148
}
146149
}
147150

148-
return { tag: "disconnected" };
151+
return { tag: "disconnected", connectedAtlasCluster: this.state.connectedAtlasCluster };
149152
}
150153

151154
get currentConnectionState(): AnyConnectionState {

src/tools/atlas/connect/connectCluster.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ export class ConnectClusterTool extends AtlasToolBase {
4545
} else {
4646
return "connected";
4747
}
48-
break;
4948
case "connecting":
5049
case "disconnected": // we might still be calling Atlas APIs and not attempted yet to connect to MongoDB, but we are still "connecting"
5150
return "connecting";
@@ -57,7 +56,6 @@ export class ConnectClusterTool extends AtlasToolBase {
5756
);
5857
return "unknown";
5958
}
60-
return "unknown";
6159
}
6260

6361
private async prepareClusterConnection(

0 commit comments

Comments
 (0)