Skip to content

Commit 1e41d9d

Browse files
update comment
1 parent 9460f9f commit 1e41d9d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/sdam/server.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,10 @@ export class Server extends TypedEventEmitter<ServerEvents> {
333333
// attempt to check out a connection from the pool. This ensures that operations that
334334
// are waiting for a connection are included in the operation count. Load balanced
335335
// mode will only ever have a single server, so the operation count doesn't matter.
336+
// Incrementing the operation count above the logic to handle load balanced mode would
337+
// require special logic to decrement it again, or would double increment (the load
338+
// balanced code makes a recursive call). Instead, we increment the count after this
339+
// check.
336340
if (this.loadBalanced && session && conn == null && isPinnableCommand(cmd, session)) {
337341
this.s.pool.checkOut((err, checkedOut) => {
338342
if (err || checkedOut == null) {

0 commit comments

Comments
 (0)