Fix deleting history that doesn't exist yet (#844)

This can occur if history has been added + then deleted on a machine
before it has a chance to be synced to a new one.
This commit is contained in:
Ellie Huxtable 2023-04-05 09:23:09 +01:00 committed by GitHub
parent f2a496848a
commit 400544738b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -95,8 +95,14 @@ async fn sync_download(
for i in remote_status.deleted { for i in remote_status.deleted {
// we will update the stored history to have this data // we will update the stored history to have this data
// pretty much everything can be nullified // pretty much everything can be nullified
let h = db.load(i.as_str()).await?; if let Ok(h) = db.load(i.as_str()).await {
db.delete(h).await?; db.delete(h).await?;
} else {
info!(
"could not delete history with id {}, not found locally",
i.as_str()
);
}
} }
Ok((local_count - initial_local, local_count)) Ok((local_count - initial_local, local_count))