Fix potential of deadlock with MQTT
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Alex Mikhalev 2020-09-27 21:51:36 -06:00
parent 794ecae2a1
commit 244eea66eb

View File

@ -73,7 +73,16 @@ async fn event_loop_task(
match incoming { match incoming {
rumqttc::Packet::ConnAck(_) => { rumqttc::Packet::ConnAck(_) => {
info!("MQTT connected"); info!("MQTT connected");
interface.publish_connected(true).await?; {
// HACK: this really should just be await
// but that can sometimes deadlock if the publish channel is full
let mut interface = interface.clone();
let fut = async move {
interface.publish_connected(true).await
};
tokio::spawn(fut);
}
//.await?;
} }
_ => {} _ => {}
} }