Skip to content

Commit

Permalink
fix(connection): correctly handle running queued connection handlers …
Browse files Browse the repository at this point in the history
…when using `setClient()`

Re: #9778
  • Loading branch information
vkarpov15 committed Apr 11, 2021
1 parent 313eada commit 56bc6a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
11 changes: 2 additions & 9 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -992,15 +992,8 @@ function _setClient(conn, client, options, dbName) {

delete conn.then;
delete conn.catch;
conn.readyState = STATES.connected;

for (const i in conn.collections) {
if (utils.object.hasOwnProperty(conn.collections, i)) {
conn.collections[i].onOpen();
}
}

conn.emit('open');

conn.onOpen();
}

/*!
Expand Down
2 changes: 1 addition & 1 deletion test/collection.capped.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('collections: capped:', function() {
});

it('creation', function() {
this.timeout(30000);
this.timeout(15000);

return co(function*() {
yield db.dropCollection('Test').catch(() => {});
Expand Down

0 comments on commit 56bc6a4

Please sign in to comment.