Skip to content

Commit afe3a39

Browse files
committed
don't clear the queue when load balanced
1 parent 1b6a049 commit afe3a39

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

src/cmap/worker.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,11 +513,13 @@ impl ConnectionPoolWorker {
513513
handler.handle_pool_cleared_event(event);
514514
});
515515

516-
for request in self.wait_queue.drain(..) {
517-
// an error means the other end hung up already, which is okay because we were
518-
// returning an error anyways
519-
let _: std::result::Result<_, _> =
520-
request.fulfill(ConnectionRequestResult::PoolCleared(cause.clone()));
516+
if !matches!(self.generation, PoolGeneration::LoadBalanced(_)) {
517+
for request in self.wait_queue.drain(..) {
518+
// an error means the other end hung up already, which is okay because we were
519+
// returning an error anyways
520+
let _: std::result::Result<_, _> =
521+
request.fulfill(ConnectionRequestResult::PoolCleared(cause.clone()));
522+
}
521523
}
522524
}
523525
}

src/test/spec/retryable_reads.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ async fn retry_read_pool_cleared() {
9191
println!("skipping retry_read_pool_cleared due to blockConnection not being supported");
9292
return;
9393
}
94+
if client.is_load_balanced() {
95+
println!("skipping retry_read_pool_cleared due to load-balanced topology");
96+
return;
97+
}
9498

9599
let collection = client
96100
.database("retry_read_pool_cleared")

src/test/spec/retryable_writes/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,11 @@ async fn retry_write_pool_cleared() {
422422
return;
423423
}
424424

425+
if client.is_load_balanced() {
426+
println!("skipping retry_write_pool_cleared due to load-balanced topology");
427+
return;
428+
}
429+
425430
let collection = client
426431
.database("retry_write_pool_cleared")
427432
.collection("retry_write_pool_cleared");

0 commit comments

Comments
 (0)