Run the people deduplication after every catalog merge (#78)
A merge is where two devices' people meet: the same name typed on each, or a redirect one of them made. So dedup_people::run now follows every successful sync::merge_remote. It runs on the sync worker, never the UI thread, before the snapshot is pushed, so what it folds reaches the server on the same pass. It runs in its own transaction, and a failure is logged, not returned. What the merge took is committed and valid either way, and the next pass tries again. Once a catalog is clean it costs 8-15 ms on the reference library (19k faces, 26k people rows). On copies of the two real catalogs, a round trip with a peer running the previous merge converges on 75 listed named people on both sides and stays there over a second round. merge_remote with the job takes 75-90 ms there.
This commit is contained in:
@@ -344,6 +344,18 @@ pub fn merge_remote(conn: &Connection, remote: &Path) -> Result<MergeReport, Cat
|
|||||||
log::warn!("failed to detach remote catalog: {e}");
|
log::warn!("failed to detach remote catalog: {e}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// After every merge, because a merge is where two devices' people meet:
|
||||||
|
// the same name typed on each, or a redirect one of them made. Its own
|
||||||
|
// transaction, and a failure is logged rather than returned -- what the
|
||||||
|
// merge took is committed and valid whether or not the duplicates were
|
||||||
|
// folded, and the next pass tries again. Runs on the sync worker, never
|
||||||
|
// the UI thread, and costs ~10 ms when there is nothing to do.
|
||||||
|
if result.is_ok() {
|
||||||
|
if let Err(e) = crate::dedup_people::run(conn) {
|
||||||
|
log::warn!("dedup after the catalog merge: {e}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user