matrix: Handle sync errors more gracefully
* Retry failed sync immediately * Trace the underlying error when sync fails
This commit is contained in:
parent
6dddbfb1e9
commit
cacbf4af45
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "matrix-feedbot"
|
name = "matrix-feedbot"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
authors = ["mirsal <mirsal@mirsal.fr>"]
|
authors = ["mirsal <mirsal@mirsal.fr>"]
|
||||||
|
@ -32,7 +32,7 @@ use tokio::{
|
|||||||
sync::broadcast
|
sync::broadcast
|
||||||
};
|
};
|
||||||
|
|
||||||
use tracing::info;
|
use tracing::{error, info};
|
||||||
|
|
||||||
async fn on_stripped_state_member(
|
async fn on_stripped_state_member(
|
||||||
room_member: StrippedRoomMemberEvent,
|
room_member: StrippedRoomMemberEvent,
|
||||||
@ -98,7 +98,13 @@ pub async fn login_and_sync<T: Clone>(
|
|||||||
|
|
||||||
loop {
|
loop {
|
||||||
tokio::select! {
|
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 {
|
recv = rx.recv() => match recv {
|
||||||
Ok((msg, rooms)) => {
|
Ok((msg, rooms)) => {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user