aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-09-12 17:19:26 +0200
committerAlex Auvolat <alex@adnab.me>2022-09-12 17:19:26 +0200
commitf0326607eebcded55fd01c41895a5b6e23bac55f (patch)
treea35e1cd5a5622cdd04ce9bd44f814487b211b353 /examples
parent0f799a7768997c37e3e1b6861c097c4cd934acde (diff)
downloadnetapp-f0326607eebcded55fd01c41895a5b6e23bac55f.tar.gz
netapp-f0326607eebcded55fd01c41895a5b6e23bac55f.zip
slightly change example
Diffstat (limited to 'examples')
-rw-r--r--examples/fullmesh.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/examples/fullmesh.rs b/examples/fullmesh.rs
index 972bec0..d0190ef 100644
--- a/examples/fullmesh.rs
+++ b/examples/fullmesh.rs
@@ -142,6 +142,7 @@ impl Example {
example_field,
hex::encode(id)
);
+ // Fake data stream with some delays in item production
let stream =
Box::pin(stream::iter([100, 200, 300, 400]).then(|x| async move {
tokio::time::sleep(Duration::from_millis(500)).await;
@@ -191,16 +192,10 @@ impl StreamingEndpointHandler<ExampleMessage> for Example {
msg.msg()
);
let source_stream = msg.take_stream().unwrap();
+ // Return same stream with 300ms delay
let new_stream = Box::pin(source_stream.then(|x| async move {
- info!(
- "Handler: stream got bytes {:?}",
- x.as_ref().map(|b| b.len())
- );
tokio::time::sleep(Duration::from_millis(300)).await;
- Ok(Bytes::from(vec![
- 10u8;
- x.map(|b| b.len()).unwrap_or(1422) * 2
- ]))
+ x
}));
Resp::new(ExampleResponse {
example_field: false,