Skip to content

Commit 19b45ce

Browse files
committed
Only reset on full sync
1 parent 188a50b commit 19b45ce

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

crates/core/src/sync_local.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,16 @@ GROUP BY b.row_type, b.row_id",
259259
fn set_last_applied_op(&self) -> Result<(), SQLiteError> {
260260
match &self.partial {
261261
Some(partial) => {
262+
// Note: This one deliberately doesn't reset count_since_last or updates
263+
// count_at_last! We want a download progress to always cover a complete sync
264+
// checkpoint instead of resetting for partial completions.
262265
// language=SQLite
263266
let updated = self
264267
.db
265268
.prepare_v2( "\
266269
UPDATE ps_buckets
267-
SET last_applied_op = last_op,
268-
count_since_last = 0,
269-
count_at_last = count_at_last + count_since_last
270-
WHERE ((last_applied_op != last_op) OR count_since_last) AND
270+
SET last_applied_op = last_op
271+
WHERE last_applied_op != last_op AND
271272
name IN (SELECT value FROM json_each(json_extract(?1, '$.buckets')))",
272273
)
273274
.into_db_result(self.db)?;

0 commit comments

Comments
 (0)