summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@ifm.com>2022-05-31 09:58:24 +0200
committerMatthias Beyer <matthias.beyer@ifm.com>2022-05-31 09:58:24 +0200
commiteef2e00b3de89a2a159066edf6faede3698dc1af (patch)
tree002974ddda597a5e06c80975dc253c061012ed05
parent225b0cc2283111276a2c5a1918e6f1d226ffab19 (diff)
parent4d9c277ffc5b2724630644128bf5f0800614c3c4 (diff)
Merge branch 'feature/add_tedge_api/optimize-bench' into feature/add_tedge_api_impl
-rw-r--r--crates/core/tedge_core/benches/simple_throughput.rs24
1 files changed, 8 insertions, 16 deletions
diff --git a/crates/core/tedge_core/benches/simple_throughput.rs b/crates/core/tedge_core/benches/simple_throughput.rs
index 2f17635f..44a87c46 100644
--- a/crates/core/tedge_core/benches/simple_throughput.rs
+++ b/crates/core/tedge_core/benches/simple_throughput.rs
@@ -73,22 +73,14 @@ impl Plugin for ProducerPlugin {
let addr = self.1.clone();
let mut count = 0;
tokio::spawn(async move {
- loop {
- tokio::select! {
- num = rec.recv() => {
- if let Some(num) = num {
- count += 1;
- //println!("Sending msg #{}", count);
- addr.send_and_wait(Measurement(num)).await
- .unwrap_or_else(|_| {
- println!("Could not send in sender for msg num #{}", count);
- panic!();
- });
- } else {
- break
- }
- }
- }
+ while let Some(num) = rec.recv().await {
+ count += 1;
+ //println!("Sending msg #{}", count);
+ addr.send_and_wait(Measurement(num)).await
+ .unwrap_or_else(|_| {
+ println!("Could not send in sender for msg num #{}", count);
+ panic!();
+ });
}
});