From 04a613daf6e6465e7c814cebc013795ebe3deb47 Mon Sep 17 00:00:00 2001 From: Troy Benson Date: Sun, 20 Oct 2024 17:58:12 +0000 Subject: [PATCH] fix send bound --- foundations/src/batcher/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/foundations/src/batcher/mod.rs b/foundations/src/batcher/mod.rs index 5b271a451..dc7c1ef42 100644 --- a/foundations/src/batcher/mod.rs +++ b/foundations/src/batcher/mod.rs @@ -330,6 +330,7 @@ impl BatcherInner { let mut waiters = vec![]; let mut batch = self.active_batch.write().await; let max_documents = self.max_batch_size.load(std::sync::atomic::Ordering::Relaxed); + let mut batches = vec![]; for document in T::Mode::filter_item_iter(documents) { if batch @@ -338,7 +339,7 @@ impl BatcherInner { .unwrap_or(true) { if let Some(b) = batch.take() { - self.queued_batches.send(b).await.ok(); + batches.push(b); } *batch = Some(self.new_batch()); @@ -362,6 +363,10 @@ impl BatcherInner { T::Mode::input_add(&mut b.ops, tracker, document); } + for batch in batches { + self.queued_batches.send(batch).await.ok(); + } + waiters } }