Skip to content

Commit

Permalink
fix: add succeded length check to avoid unnecessary connections
Browse files Browse the repository at this point in the history
  • Loading branch information
hydra-yse committed Nov 28, 2024
1 parent f6f2a27 commit 42856fc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/core/src/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl SyncService {
if let Some(sync_state) = &maybe_sync_state {
if sync_state.record_revision >= new_record.revision {
log::info!("Remote record revision is lower or equal to the persisted one. Skipping update.");
return Ok(())
return Ok(());
}
}

Expand Down Expand Up @@ -266,7 +266,9 @@ impl SyncService {
succeded.push(record_id);
}

self.persister.remove_incoming_records(succeded)?;
if !succeded.is_empty() {
self.persister.remove_incoming_records(succeded)?;
}

Ok(())
}
Expand Down Expand Up @@ -335,7 +337,9 @@ impl SyncService {
succeded.push(record_id);
}

self.persister.remove_sync_outgoing_changes(succeded)?;
if !succeded.is_empty() {
self.persister.remove_sync_outgoing_changes(succeded)?;
}

Ok(())
}
Expand Down

0 comments on commit 42856fc

Please sign in to comment.