use tracing_subscriber, handle subscription error

This commit is contained in:
Cappy Ishihara 2024-06-02 03:21:58 +07:00
parent 026c6a950e
commit a5be9f187b
No known key found for this signature in database
GPG key ID: 50862C285CB76906
4 changed files with 156 additions and 25 deletions

View file

@ -206,10 +206,21 @@ async fn subscribe(
return;
}
msg = rx.recv() => {
if socket.send(msg.unwrap()).await.is_err() {
error!("Forced shutdown SUB due error!");
return;
};
let msg = msg.ok();
if let Some(msg) = msg {
// debug!("[WebSocketSubscriber] Received: {msg}");
if socket.send(msg.clone()).await.is_err() {
error!("Forced shutdown SUB due error!");
return;
};
}
// if socket.send(msg.unwrap()).await.is_err() {
// error!("Forced shutdown SUB due error!");
// return;
// };
}
}
}