fix(sync): a new device's first sync of a large library goes through
Some checks failed
CI / check (push) Has been cancelled

A device that had never synced a space collected everything it lacked from
the server, which read each change's domain row with a statement of its
own and sent nothing before all were read. On halkyon.li, a new device's
first sync of a library of 56,621 rows (8,190 cards, 20,961 reviews) kept
the server's one thread busy about 100 s; the client, hearing nothing for
40 s, not even the pongs to its pings, closed the stream, and every attempt
five minutes later started over, so that device never synced.

The fork of serverpod_offline_sync moves to the signed 741e334 on its
branch halkyon/batched-row-reads (stacked on halkyon/batch-inserts), which
reads those rows 500 to a statement per table and space in the same
snapshot: 120,194 changes took 51.5 to 53.6 s to collect on embedded
PostgreSQL before, 16.9 to 17.1 s after, the same bytes on the wire.

Whats-New: A new device now gets through its first sync of a large library instead of stopping and starting over.
Whats-New-De: Ein neues Gerät schafft jetzt seinen ersten Abgleich auch einer großen Bibliothek, statt abzubrechen und von vorn anzufangen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-09 15:47:36 +01:00
commit 0cd329566f
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
3 changed files with 14 additions and 9 deletions

File diff suppressed because one or more lines are too long

View file

@ -1880,8 +1880,8 @@ packages:
dependency: "direct overridden"
description:
path: "packages/serverpod_offline_sync"
ref: "949a6645e08af27bb61c96d7ddc2b6d145fed554"
resolved-ref: "949a6645e08af27bb61c96d7ddc2b6d145fed554"
ref: "741e334d6ac4ca89f99945dda2e444152ee32994"
resolved-ref: "741e334d6ac4ca89f99945dda2e444152ee32994"
url: "https://code.halkyon.app/project-halkyon/serverpod-offline-sync.git"
source: git
version: "0.0.10"

View file

@ -72,7 +72,7 @@ dependency_overrides:
path: third_party/flutter_web_auth_2
keyboard_height_plugin:
path: third_party/keyboard_height_plugin
# The offline sync package's shared part from our fork: v0.0.10 with seven
# The offline sync package's shared part from our fork: v0.0.10 with eight
# changes. Byte payloads compared as bytes: v0.0.10 compares them byte by byte
# through a UUID parse that throws for each byte, so a sync touching a few thousand
# cards kept the server busy for minutes, answering nobody, while its client timed
@ -86,15 +86,20 @@ dependency_overrides:
# Such a merge writes its new rows up to 1,000 to a statement: a first push of
# that library took the server 35 s, now 5 (2026-10-17). And projections are
# rebuilt once after the synced tables changed, not on every session and merge
# (upstream #150). Pinned to a signed commit of the fork's branch
# halkyon/batch-inserts (on halkyon/fast-merge-deletes, on halkyon/fast-merges,
# on halkyon/fast-deletes, on halkyon/inbound-merges, on halkyon/byte-payloads);
# drop each change once a release of the package has it.
# (upstream #150). The changes a device lacks are collected with their rows read
# 500 to a statement per table, not one statement each: a new device's first sync
# of a library of 56,000 rows kept halkyon.li's server busy some 100 s, sending
# nothing, so the client closed the stream after 40 s and started over
# (2026-11-09). Pinned to a signed commit of the fork's branch
# halkyon/batched-row-reads (on halkyon/batch-inserts, on
# halkyon/fast-merge-deletes, on halkyon/fast-merges, on halkyon/fast-deletes, on
# halkyon/inbound-merges, on halkyon/byte-payloads); drop each change once a
# release of the package has it.
serverpod_offline_sync:
git:
url: https://code.halkyon.app/project-halkyon/serverpod-offline-sync.git
path: packages/serverpod_offline_sync
ref: 949a6645e08af27bb61c96d7ddc2b6d145fed554
ref: 741e334d6ac4ca89f99945dda2e444152ee32994
# Melos (https://melos.invertase.dev): its scripts run across the workspace's packages,
# `dart run melos run <name>`, and take Melos' filters, such as