summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@ifm.com>2022-04-21 09:35:03 +0200
committerMarcel Müller <m.mueller@ifm.com>2022-04-21 09:35:03 +0200
commit688915331049660888a244bf2f1118284a19fa82 (patch)
treec42ff015b0b5490c0e88abe10b354ede47627a46
parent7ad7b6e34f26ac525b9ddb45661353bf17748521 (diff)
Do not await a just-spawned task in a loop
Signed-off-by: Marcel Müller <m.mueller@ifm.com>
-rw-r--r--crates/core/tedge_core/src/plugin_task.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/crates/core/tedge_core/src/plugin_task.rs b/crates/core/tedge_core/src/plugin_task.rs
index 3910f2d5..25a9c081 100644
--- a/crates/core/tedge_core/src/plugin_task.rs
+++ b/crates/core/tedge_core/src/plugin_task.rs
@@ -128,8 +128,6 @@ async fn plugin_mainloop(
let pname = plugin_name.to_string();
let plug = plugin.clone();
- // send the future that calls Plugin::handle_message() to the task that
- // takes care of awaiting these futures.
tokio::spawn(async move {
let read_plug = plug.read().await;
match std::panic::AssertUnwindSafe(read_plug.handle_message(msg)).catch_unwind().await {
@@ -143,8 +141,7 @@ async fn plugin_mainloop(
Ok(Err(e)) => warn!("Plugin failed to handle message: {:?}", e),
}
Ok(())
- }).await
- .map_err(|_| TedgeApplicationError::PluginMessageHandlingFailed(plugin_name.to_string()))??;
+ });
},
None => {