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

fix: revert use of setImmediate to process.nextTick #2611

Merged
merged 1 commit into from
Nov 6, 2020
Merged
Changes from all commits
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
8 changes: 4 additions & 4 deletions lib/cmap/connection_pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class ConnectionPool extends EventEmitter {
}

this[kWaitQueue].push(waitQueueMember);
setImmediate(() => processWaitQueue(this));
process.nextTick(() => processWaitQueue(this));
}

/**
Expand All @@ -258,7 +258,7 @@ class ConnectionPool extends EventEmitter {
destroyConnection(this, connection, reason);
}

setImmediate(() => processWaitQueue(this));
process.nextTick(() => processWaitQueue(this));
}

/**
Expand Down Expand Up @@ -428,7 +428,7 @@ function createConnection(pool, callback) {

// otherwise add it to the pool for later acquisition, and try to process the wait queue
pool[kConnections].push(connection);
setImmediate(() => processWaitQueue(pool));
process.nextTick(() => processWaitQueue(pool));
});
}

Expand All @@ -439,7 +439,7 @@ function destroyConnection(pool, connection, reason) {
pool[kPermits]++;

// destroy the connection
setImmediate(() => connection.destroy());
process.nextTick(() => connection.destroy());
}

function processWaitQueue(pool) {
Expand Down