Skip to content

Commit

Permalink
Make failure of contacts syncing optional (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
gferon authored Mar 19, 2023
1 parent adc5b97 commit 5f71fe7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{
};

use futures::{channel::mpsc, channel::oneshot, future, pin_mut, AsyncReadExt, Stream, StreamExt};
use log::{debug, error, info, trace};
use log::{debug, error, info, trace, warn};
use parking_lot::Mutex;
use rand::{distributions::Alphanumeric, prelude::ThreadRng, Rng, RngCore};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -355,11 +355,15 @@ impl<C: Store> Manager<C, Linking> {
manager.set_account_attributes().await,
manager.sync_contacts().await,
) {
(Err(e), _, _) | (_, Err(e), _) | (_, _, Err(e)) => {
(Err(e), _, _) | (_, Err(e), _) => {
// clear the entire store on any error, there's no possible recovery here
manager.config_store.clear_registration()?;
Err(e)
}
(_, _, Err(e)) => {
warn!("failed to synchronize contacts: {e}");
Ok(manager)
}
_ => Ok(manager),
}
}
Expand Down

0 comments on commit 5f71fe7

Please sign in to comment.