diff options
author | Andreas Holskil <andreas.holskil@telenor.com> | 2023-12-12 13:20:21 +0100 |
---|---|---|
committer | Andreas Holskil <andreas.holskil@telenor.com> | 2023-12-12 13:20:21 +0100 |
commit | 20d26c3c9d0de263dd1403e392b312e5584d29f3 (patch) | |
tree | 655b847e145382470551dd9ef2e9445c3f5ea682 | |
parent | 6ab19a356d5b90dcd5bab336d1b39953480173b3 (diff) |
fix: make sure to start mqtt eventloop before returning
-rw-r--r-- | src/lib.rs | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -4,7 +4,10 @@ mod eventloop; mod mqtt; mod stridulus_event; mod util; +use std::time::Duration; + use log::{debug, error}; +use tokio::time::sleep; use tokio::{sync::mpsc, task}; pub use crate::client::StridulusClient; @@ -43,6 +46,8 @@ pub async fn create( } }); + sleep(Duration::from_millis(10)).await; // to make sure the mqtt eventloop is running + Ok(( StridulusClient { client: mqtt_client, |