Never block reconcile on per-file downloads; request evicted files up front

On a first attach (new Mac, reinstall) the whole tree is evicted and the
bounded per-file wait (~30s, serial) left the UI empty for hours. Reconcile
now fires all download requests immediately, sweeps the files that are
already current, and parks evicted paths as unreadable (keeping their cache
entities) — the metadata observer imports each file the moment bird
materializes it.
This commit is contained in:
2026-07-16 20:29:37 -04:00
parent 373f812968
commit 037753832c
+13
View File
@@ -779,12 +779,25 @@ final class SyncEngine {
let tombstoned = await tombstones.listStubIDs()
let dataFiles = await store.list().filter { !$0.hasPrefix("Stubs/") }
// Fire download requests for every evicted file up front so bird
// materializes them in parallel while this pass sweeps the current ones.
await store.downloadEvictedFiles(inSubdirectory: nil)
var liveRoutineIDs = Set<String>()
var liveWorkoutIDs = Set<String>()
var liveScheduleIDs = Set<String>()
var unreadablePaths = Set<String>()
for path in dataFiles {
// Never block on a per-file download here: on a first attach (a new
// Mac, a reinstall) the whole tree is evicted and the bounded wait
// is ~30s per file, serially hours of empty UI. Skip it like an
// unreadable path (the prune below keeps its cache entity) and let
// the metadata observer import it the moment it materializes.
if await store.isEvicted(path) {
unreadablePaths.insert(path)
continue
}
let data: Data
do {
data = try await store.readData(from: path)