Skip to content

Commit

Permalink
Fix response ordering, drop Option from DetectorRequest parameters (#59)
Browse files Browse the repository at this point in the history
Signed-off-by: declark1 <[email protected]>
  • Loading branch information
declark1 authored Jun 4, 2024
1 parent 3f066cb commit 01514f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 1 addition & 6 deletions src/clients/detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,11 @@ impl DetectorClient {
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DetectorRequest {
pub text: String,
pub parameters: Option<HashMap<String, serde_json::Value>>,
pub parameters: HashMap<String, serde_json::Value>,
}

impl DetectorRequest {
pub fn new(text: String, parameters: HashMap<String, serde_json::Value>) -> Self {
let parameters = if parameters.is_empty() {
None
} else {
Some(parameters)
};
Self { text, parameters }
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ async fn handle_chunk_task(
Ok::<Vec<Chunk>, Error>(results)
}
})
.buffer_unordered(5)
.buffered(5)
.collect::<Vec<_>>()
.await
.into_iter()
Expand Down Expand Up @@ -373,7 +373,7 @@ async fn handle_detection_task(
Ok::<Vec<TokenClassificationResult>, Error>(results)
}
})
.buffer_unordered(5)
.buffered(5)
.collect::<Vec<_>>()
.await
.into_iter()
Expand Down

0 comments on commit 01514f3

Please sign in to comment.