chore: log mqtt error.

This commit is contained in:
Ivan Li 2023-01-29 04:18:57 +08:00
parent bd025d6d71
commit 6ec61c1bcc
2 changed files with 11 additions and 5 deletions

View File

@ -221,7 +221,7 @@ impl CoreManager {
if let AmbientLightMode::Follow = *lock { if let AmbientLightMode::Follow = *lock {
drop(lock); drop(lock);
let screenshot = picker.take_screenshot()?; let screenshot = picker.take_screenshot()?;
info!("Take Screenshot Spend: {:?}", start.elapsed()); // info!("Take Screenshot Spend: {:?}", start.elapsed());
match tx.send(screenshot).await { match tx.send(screenshot).await {
Ok(_) => {} Ok(_) => {}
Err(err) => { Err(err) => {

View File

@ -1,5 +1,5 @@
use rumqttc::{AsyncClient, MqttOptions, QoS}; use rumqttc::{AsyncClient, MqttOptions, QoS};
use std::{time::Duration}; use std::time::Duration;
use time::{format_description, OffsetDateTime}; use time::{format_description, OffsetDateTime};
use tokio::task; use tokio::task;
use tracing::warn; use tracing::warn;
@ -15,8 +15,13 @@ impl MqttConnection {
let (client, mut eventloop) = AsyncClient::new(options, 10); let (client, mut eventloop) = AsyncClient::new(options, 10);
task::spawn(async move { task::spawn(async move {
while let Ok(notification) = eventloop.poll().await { loop {
// println!("Received = {:?}", notification); match eventloop.poll().await {
Ok(_) => {}
Err(err) => {
println!("MQTT Error Event = {:?}", err);
}
}
} }
}); });
Self { client } Self { client }
@ -29,7 +34,8 @@ impl MqttConnection {
async fn subscribe_board(&self) { async fn subscribe_board(&self) {
self.client self.client
.subscribe("display-ambient-light/board/#", QoS::AtMostOnce).await; .subscribe("display-ambient-light/board/#", QoS::AtMostOnce)
.await;
} }
fn broadcast_desktop_online(&mut self) { fn broadcast_desktop_online(&mut self) {