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 {
3535 }
3636
3737 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+
3845 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- }
4846 case "connecting" :
4947 case "disconnected" : // we might still be calling Atlas APIs and not attempted yet to connect to MongoDB, but we are still "connecting"
5048 return "connecting" ;
49+ case "connected" :
50+ return "connected" ;
5151 case "errored" :
5252 logger . debug (
5353 LogId . atlasConnectFailure ,
@@ -218,10 +218,9 @@ export class ConnectClusterTool extends AtlasToolBase {
218218 break ;
219219 }
220220 case "connected-to-other-cluster" :
221- await this . session . disconnect ( ) ;
222- // eslint-disable-next-line no-fallthrough
223221 case "disconnected" :
224222 default : {
223+ await this . session . disconnect ( ) ;
225224 const { connectionString, atlas } = await this . prepareClusterConnection ( projectId , clusterName ) ;
226225
227226 // try to connect for about 5 minutes asynchronously
You can’t perform that action at this time.
0 commit comments