If connection is lost to the mqtt server, attempt to reconnect instead of panicking
This commit is contained in:
parent
06389d83f7
commit
d55540a6c0
|
@ -1,6 +1,6 @@
|
|||
use async_trait::async_trait;
|
||||
use serde::{Serialize, Deserialize};
|
||||
use tracing::{error, debug};
|
||||
use tracing::{debug, warn};
|
||||
|
||||
use rumqttc::{Publish, Event, Incoming, EventLoop};
|
||||
use tokio::sync::broadcast;
|
||||
|
@ -39,13 +39,12 @@ impl Mqtt {
|
|||
},
|
||||
Ok(..) => continue,
|
||||
Err(err) => {
|
||||
error!("{}", err);
|
||||
break
|
||||
// Something has gone wrong
|
||||
// We stay in the loop as that will attempt to reconnect
|
||||
warn!("{}", err);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
todo!("Error in MQTT (most likely lost connection to mqtt server), we need to handle these errors!");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user