You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sync: the status refresh reads every answered push and agreed row on each cycle #209
(*loop).refreshStatus (internal/syncer/loop.go:1320-1380) runs at the end of every sync cycle (loop.go:365), also an idle one. To fill 3 numbers of sync.status it reads whole tables:
db.Pending (internal/store/remotes.go:336) and db.PendingConflicts (:508): every pending change, with correlated subqueries over sync_pushes, only to take len(...).
db.Unanswered (remotes.go:412): every unanswered push, to count the conflict pushes.
db.AgreedRows (remotes.go:311): every agreed row of the vault, to count the conflicted ones.
refusals (loop.go:1383-1410): db.Pushes returns every answered push the device ever made (remotes.go:418, localPushes with no limit), builds a map of the newest push per file, then runs db.FileByID for each refused one.
No code deletes rows from sync_pushes (grep -n sync_pushes internal/store/*.go finds only INSERT and UPDATE), so the refusals scan grows with every push for the life of the vault, and it runs on every cycle.
What's wanted: the counts from COUNT(*) queries (or 1 query that returns the 3 counts), and the refusals from a query that selects only the newest push per file whose status is refused. Whether sync_pushes should drop answered rows that a newer push of the same file supersedes is a retention question for docs/specs/sync-protocol.md; it is not needed for the first part.
Activity