chore: Log errors from failed pub/sub messages

This commit is contained in:
Zomatree
2023-08-10 21:04:31 +01:00
committed by Paul Makles
parent bfdd713d38
commit 92032cd9bc
3 changed files with 11 additions and 5 deletions

View File

@@ -136,13 +136,13 @@ pub fn spawn_client(db: &'static Database, stream: TcpStream, addr: SocketAddr)
);*/
// Handle incoming events.
match conn.on_message().next().await.map(|item| {
(
match conn.on_message().next().await.map(|res| {
res.map(|item|(
item.get_channel_name().to_string(),
redis_kiss::decode_payload::<EventV1>(&item),
)
))
}) {
Some((channel, item)) => {
Some(Ok((channel, item))) => {
if let Ok(mut event) = item {
if state
.handle_incoming_event_v1(
@@ -160,6 +160,11 @@ pub fn spawn_client(db: &'static Database, stream: TcpStream, addr: SocketAddr)
warn!("Failed to deserialise an event for {channel}!");
}
}
Some(Err(e)) => {
info!("Error while consuming pub/sub messages: {e:?}");
sentry::capture_error(&e);
break
}
// No more data, assume we disconnected or otherwise
// something bad occurred, so disconnect user.
None => break,