Skip to content

fix(NODE-4649): use SDAM handling for errors from min pool size population #3424

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

Merged
merged 10 commits into from
Sep 28, 2022
Prev Previous commit
Next Next commit
fix: emit connectionClosed event on establishment error
  • Loading branch information
dariakp committed Sep 27, 2022
commit 74862b16de37bee6db9ea5c71cc3d03e45c54f81
4 changes: 4 additions & 0 deletions src/cmap/connection_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,10 @@ export class ConnectionPool extends TypedEventEmitter<ConnectionPoolEvents> {
if (err || !connection) {
this[kLogger].debug(`connection attempt failed with error [${JSON.stringify(err)}]`);
this[kPending]--;
this.emit(
ConnectionPool.CONNECTION_CLOSED,
new ConnectionClosedEvent(this, { id: connectOptions.id } as Connection, 'error')
);
callback(err ?? new MongoRuntimeError('Connection creation failed without error'));
return;
}
Expand Down