Skip to content

Commit 6b5f49b

Browse files
committed
chore: minor clean up of redundant params
1 parent 0a77b97 commit 6b5f49b

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

src/tools/atlas/connect/connectCluster.ts

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,7 @@ export class ConnectClusterTool extends AtlasToolBase {
128128
return { connectionString: cn.toString(), atlas: connectedAtlasCluster };
129129
}
130130

131-
private async connectToCluster(
132-
projectId: string,
133-
clusterName: string,
134-
connectionString: string,
135-
atlas: AtlasClusterConnectionInfo
136-
): Promise<void> {
131+
private async connectToCluster(connectionString: string, atlas: AtlasClusterConnectionInfo): Promise<void> {
137132
let lastError: Error | undefined = undefined;
138133

139134
logger.debug(
@@ -146,8 +141,8 @@ export class ConnectClusterTool extends AtlasToolBase {
146141
for (let i = 0; i < 600; i++) {
147142
if (
148143
!this.session.connectedAtlasCluster ||
149-
this.session.connectedAtlasCluster.projectId != projectId ||
150-
this.session.connectedAtlasCluster.clusterName != clusterName
144+
this.session.connectedAtlasCluster.projectId != atlas.projectId ||
145+
this.session.connectedAtlasCluster.clusterName != atlas.clusterName
151146
) {
152147
throw new Error("Cluster connection aborted");
153148
}
@@ -174,8 +169,8 @@ export class ConnectClusterTool extends AtlasToolBase {
174169

175170
if (lastError) {
176171
if (
177-
this.session.connectedAtlasCluster?.projectId == projectId &&
178-
this.session.connectedAtlasCluster?.clusterName == clusterName &&
172+
this.session.connectedAtlasCluster?.projectId == atlas.projectId &&
173+
this.session.connectedAtlasCluster?.clusterName == atlas.clusterName &&
179174
this.session.connectedAtlasCluster?.username
180175
) {
181176
void this.session.apiClient
@@ -233,16 +228,14 @@ export class ConnectClusterTool extends AtlasToolBase {
233228
const { connectionString, atlas } = await this.prepareClusterConnection(projectId, clusterName);
234229

235230
// try to connect for about 5 minutes asynchronously
236-
void this.connectToCluster(projectId, clusterName, connectionString, atlas).catch(
237-
(err: unknown) => {
238-
const error = err instanceof Error ? err : new Error(String(err));
239-
logger.error(
240-
LogId.atlasConnectFailure,
241-
"atlas-connect-cluster",
242-
`error connecting to cluster: ${error.message}`
243-
);
244-
}
245-
);
231+
void this.connectToCluster(connectionString, atlas).catch((err: unknown) => {
232+
const error = err instanceof Error ? err : new Error(String(err));
233+
logger.error(
234+
LogId.atlasConnectFailure,
235+
"atlas-connect-cluster",
236+
`error connecting to cluster: ${error.message}`
237+
);
238+
});
246239
break;
247240
}
248241
}

0 commit comments

Comments
 (0)