fix(daemon): dispatch due repos longest-waiting first

With the worker pool, a full pass every fetch_interval_s re-marked every repo
due 'now' and dispatch went by path, so when a cycle took longer than the
interval the repos late in the alphabet never got a pass (52 of 80 on a real
machine). Keep the earlier due time and dispatch by it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Opus 5.5 committed 2026-11-17 17:03:51 +01:00
1 parent 380fff5395
commit 51450ffa5e
3 files changed
+54 -4

No files matched your search

+3
View File
@@ -21,6 +21,9 @@ is `grove_core::sync::sync_repo`, the same code the CLI runs. The daemon only de
the passes, so a slow or hanging fetch of one repo no longer holds up the others. A repo never
has two passes at once: one that becomes due while its pass runs is dispatched when it ends.
Events that arrive during a pass queue another pass; it finds nothing to do and ends the chain.
Due repos are dispatched longest-waiting first, and a full pass never moves an earlier due
time later, so when a cycle takes longer than `fetch_interval_s` every repo still gets its
turn (dispatching by path starved the repos late in the alphabet).
Passes are handed out only to idle workers, so the rest stay due: pause stops them, and whether
a pass runs offline (backoff) is decided when it starts. A `sync` request for a repo whose pass
is running is not undone by that pass failing. A panicking pass is logged and counts as a