File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -35,19 +35,19 @@ export class ConnectClusterTool extends AtlasToolBase {
35
35
}
36
36
37
37
const currentConectionState = this . session . connectionManager . currentConnectionState ;
38
+ if (
39
+ this . session . connectedAtlasCluster . projectId !== projectId ||
40
+ this . session . connectedAtlasCluster . clusterName !== clusterName
41
+ ) {
42
+ return "connected-to-other-cluster" ;
43
+ }
44
+
38
45
switch ( currentConectionState . tag ) {
39
- case "connected" :
40
- if (
41
- this . session . connectedAtlasCluster . projectId !== projectId ||
42
- this . session . connectedAtlasCluster . clusterName !== clusterName
43
- ) {
44
- return "connected-to-other-cluster" ;
45
- } else {
46
- return "connected" ;
47
- }
48
46
case "connecting" :
49
47
case "disconnected" : // we might still be calling Atlas APIs and not attempted yet to connect to MongoDB, but we are still "connecting"
50
48
return "connecting" ;
49
+ case "connected" :
50
+ return "connected" ;
51
51
case "errored" :
52
52
logger . debug (
53
53
LogId . atlasConnectFailure ,
@@ -218,10 +218,9 @@ export class ConnectClusterTool extends AtlasToolBase {
218
218
break ;
219
219
}
220
220
case "connected-to-other-cluster" :
221
- await this . session . disconnect ( ) ;
222
- // eslint-disable-next-line no-fallthrough
223
221
case "disconnected" :
224
222
default : {
223
+ await this . session . disconnect ( ) ;
225
224
const { connectionString, atlas } = await this . prepareClusterConnection ( projectId , clusterName ) ;
226
225
227
226
// try to connect for about 5 minutes asynchronously
You can’t perform that action at this time.
0 commit comments