From 01514f3cccf7b46f873d16250e13d378fb6a8907 Mon Sep 17 00:00:00 2001 From: Dan Clark <44146800+declark1@users.noreply.github.com> Date: Mon, 3 Jun 2024 17:27:39 -0700 Subject: [PATCH] Fix response ordering, drop Option from DetectorRequest parameters (#59) Signed-off-by: declark1 --- src/clients/detector.rs | 7 +------ src/orchestrator.rs | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/clients/detector.rs b/src/clients/detector.rs index 183f6c3c..2725f5b5 100644 --- a/src/clients/detector.rs +++ b/src/clients/detector.rs @@ -50,16 +50,11 @@ impl DetectorClient { #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DetectorRequest { pub text: String, - pub parameters: Option>, + pub parameters: HashMap, } impl DetectorRequest { pub fn new(text: String, parameters: HashMap) -> Self { - let parameters = if parameters.is_empty() { - None - } else { - Some(parameters) - }; Self { text, parameters } } } diff --git a/src/orchestrator.rs b/src/orchestrator.rs index 6328cd5a..4afc3de1 100644 --- a/src/orchestrator.rs +++ b/src/orchestrator.rs @@ -308,7 +308,7 @@ async fn handle_chunk_task( Ok::, Error>(results) } }) - .buffer_unordered(5) + .buffered(5) .collect::>() .await .into_iter() @@ -373,7 +373,7 @@ async fn handle_detection_task( Ok::, Error>(results) } }) - .buffer_unordered(5) + .buffered(5) .collect::>() .await .into_iter()