Skip to content

Commit 76e8ab5

Browse files
committed
chore: clean up atlas resource handling
1 parent 71dbf56 commit 76e8ab5

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/common/connectionManager.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,11 @@ export class ConnectionManager extends EventEmitter<ConnectionManagerEvents> {
143143
} finally {
144144
this.changeState("connection-closed", {
145145
tag: "disconnected",
146-
connectedAtlasCluster: this.state.connectedAtlasCluster,
147146
});
148147
}
149148
}
150149

151-
return { tag: "disconnected", connectedAtlasCluster: this.state.connectedAtlasCluster };
150+
return { tag: "disconnected" };
152151
}
153152

154153
get currentConnectionState(): AnyConnectionState {

src/tools/atlas/connect/connectCluster.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,6 @@ export class ConnectClusterTool extends AtlasToolBase {
135135

136136
// try to connect for about 5 minutes
137137
for (let i = 0; i < 600; i++) {
138-
if (
139-
!this.session.connectedAtlasCluster ||
140-
this.session.connectedAtlasCluster.projectId !== atlas.projectId ||
141-
this.session.connectedAtlasCluster.clusterName !== atlas.clusterName
142-
) {
143-
throw new Error("Cluster connection aborted");
144-
}
145-
146138
try {
147139
lastError = undefined;
148140

@@ -161,6 +153,14 @@ export class ConnectClusterTool extends AtlasToolBase {
161153

162154
await sleep(500); // wait for 500ms before retrying
163155
}
156+
157+
if (
158+
!this.session.connectedAtlasCluster ||
159+
this.session.connectedAtlasCluster.projectId !== atlas.projectId ||
160+
this.session.connectedAtlasCluster.clusterName !== atlas.clusterName
161+
) {
162+
throw new Error("Cluster connection aborted");
163+
}
164164
}
165165

166166
if (lastError) {

0 commit comments

Comments
 (0)