Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(NODE-6008): deprecate CloseOptions interface #4030

Merged
merged 21 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
eslint and build fixes
  • Loading branch information
W-A-James committed Mar 6, 2024
commit d1f3817d3429e7f336e2f93b8df8891b3982fd97
2 changes: 1 addition & 1 deletion src/cmap/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function connect(options: ConnectionOptions): Promise<Connection> {
await performInitialHandshake(connection, options);
return connection;
} catch (error) {
connection?.destroy({ force: false });
connection?.destroy();
throw error;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/mongo_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> {
try {
await promisify(callback => this.topology?.connect(options, callback))();
} catch (error) {
this.topology?.close({ force: true });
this.topology?.close();
throw error;
}
};
Expand Down
14 changes: 7 additions & 7 deletions src/sdam/monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ function resetMonitorState(monitor: Monitor) {

monitor[kCancellationToken].emit('cancel');

monitor.connection?.destroy({ force: true });
monitor.connection?.destroy();
monitor.connection = null;
}

Expand Down Expand Up @@ -247,7 +247,7 @@ function checkServer(monitor: Monitor, callback: Callback<Document | null>) {
);

function onHeartbeatFailed(err: Error) {
monitor.connection?.destroy({ force: true });
monitor.connection?.destroy();
monitor.connection = null;

monitor.emitAndLogHeartbeat(
Expand Down Expand Up @@ -366,13 +366,13 @@ function checkServer(monitor: Monitor, callback: Callback<Document | null>) {
await performInitialHandshake(connection, monitor.connectOptions);
return connection;
} catch (error) {
connection.destroy({ force: false });
connection.destroy();
throw error;
}
})().then(
connection => {
if (isInCloseState(monitor)) {
connection.destroy({ force: true });
connection.destroy();
return;
}

Expand Down Expand Up @@ -479,7 +479,7 @@ export class RTTPinger {
this.closed = true;
clearTimeout(this[kMonitorId]);

this.connection?.destroy({ force: true });
this.connection?.destroy();
this.connection = undefined;
}
}
Expand All @@ -495,7 +495,7 @@ function measureRoundTripTime(rttPinger: RTTPinger, options: RTTPingerOptions) {

function measureAndReschedule(conn?: Connection) {
if (rttPinger.closed) {
conn?.destroy({ force: true });
conn?.destroy();
return;
}

Expand Down Expand Up @@ -529,7 +529,7 @@ function measureRoundTripTime(rttPinger: RTTPinger, options: RTTPingerOptions) {
connection.command(ns('admin.$cmd'), { [commandName]: 1 }, undefined).then(
() => measureAndReschedule(),
() => {
rttPinger.connection?.destroy({ force: true });
rttPinger.connection?.destroy();
rttPinger.connection = undefined;
rttPinger[kRoundTripTime] = 0;
return;
Expand Down
2 changes: 1 addition & 1 deletion test/unit/error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ describe('MongoErrors', () => {
// cleanup the server before calling done
const cleanup = err => {
topology.close();
done();
done(err);
};

if (err) {
Expand Down
Loading