matrix: Handle sync errors more gracefully

* Retry failed sync immediately
 * Trace the underlying error when sync fails
This commit is contained in:
mirsal 2025-04-28 18:25:40 +00:00
parent 6dddbfb1e9
commit cacbf4af45
Signed by: mirsal
GPG Key ID: F78F9FE84AE5B610
2 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "matrix-feedbot"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
license = "GPL-3.0-or-later"
authors = ["mirsal <mirsal@mirsal.fr>"]

View File

@ -32,7 +32,7 @@ use tokio::{
sync::broadcast
};
use tracing::info;
use tracing::{error, info};
async fn on_stripped_state_member(
room_member: StrippedRoomMemberEvent,
@ -98,7 +98,13 @@ pub async fn login_and_sync<T: Clone>(
loop {
tokio::select! {
Ok(_) = client.sync(settings.clone()) => return Ok(()),
res = client.sync(settings.clone()) => match res {
Ok(_) => return Ok(()),
Err(e) => {
error!("Sync error: {e:?}");
()
}
},
recv = rx.recv() => match recv {
Ok((msg, rooms)) => {