Skip to content

Commit

Permalink
Don't relink implicitly when the manager cannot be loaded. (#345)
Browse files Browse the repository at this point in the history
Fixes #337. This avoids unintended relinks when encountering network issues.
  • Loading branch information
hrdl-github authored Jan 3, 2025
1 parent c167fd9 commit ecf8a94
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/signal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,15 @@ pub async fn ensure_linked_device(

if !relink {
if let Some(config) = config.clone() {
if let Ok(manager) = presage::Manager::load_registered(store.clone()).await {
// done loading manager from store
return Ok((Box::new(PresageManager::new(manager)), config));
}
match presage::Manager::load_registered(store.clone()).await {
Ok(manager) => {
// done loading manager from store
return Ok((Box::new(PresageManager::new(manager)), config));
}
Err(e) => {
bail!("error loading manager. Try again later or run with --relink to force relink: {}", e)
}
};
}
}

Expand Down

0 comments on commit ecf8a94

Please sign in to comment.