Fix MS Exchange duplicate ids issue

This commit is contained in:
Maurus Decimus
2026-06-04 13:13:02 +02:00
parent e49a7db278
commit 5197ed6a11
7 changed files with 116 additions and 5 deletions
+2 -1
View File
@@ -33,6 +33,7 @@ pub fn reconcile_all(
let local: HashMap<String, i64> =
exchange_graph_ids::ids_of_type(conn, ctx.source_id, exchange_graph_ids::CALENDAR_EVENT)?;
let mut server_total: std::collections::HashSet<String> = std::collections::HashSet::new();
let mut planned: std::collections::HashSet<String> = std::collections::HashSet::new();
let mut any_failure = false;
for cal in calendars {
@@ -55,7 +56,7 @@ pub fn reconcile_all(
_ => {
if let Some(id) = stub.get("id").and_then(Value::as_str) {
server_total.insert(id.to_owned());
if !local.contains_key(id) {
if !local.contains_key(id) && planned.insert(id.to_owned()) {
want_ids.push(id.to_owned());
}
}
+2 -1
View File
@@ -30,6 +30,7 @@ pub fn reconcile_all(
let local: HashMap<String, i64> =
exchange_graph_ids::ids_of_type(conn, ctx.source_id, exchange_graph_ids::CONTACT_CARD)?;
let mut server_total: std::collections::HashSet<String> = std::collections::HashSet::new();
let mut planned: std::collections::HashSet<String> = std::collections::HashSet::new();
let mut any_failure = false;
for book in books {
@@ -60,7 +61,7 @@ pub fn reconcile_all(
}
let new_ids: Vec<String> = ids
.into_iter()
.filter(|id| !local.contains_key(id))
.filter(|id| !local.contains_key(id) && planned.insert(id.clone()))
.collect();
if new_ids.is_empty() {
continue;
+2 -1
View File
@@ -30,6 +30,7 @@ pub fn reconcile_all(
let local: std::collections::HashMap<String, i64> =
exchange_graph_ids::ids_of_type(conn, ctx.source_id, exchange_graph_ids::EMAIL)?;
let mut server_total: std::collections::HashSet<String> = std::collections::HashSet::new();
let mut planned: std::collections::HashSet<String> = std::collections::HashSet::new();
let mut any_failure = false;
for folder in folders {
@@ -58,7 +59,7 @@ pub fn reconcile_all(
}
let new_ids: Vec<String> = ids
.into_iter()
.filter(|id| !local.contains_key(id))
.filter(|id| !local.contains_key(id) && planned.insert(id.clone()))
.collect();
if new_ids.is_empty() {
continue;