mirror of
https://github.com/Dasemu/Grove.git
synced 2026-11-26 23:36:11 +00:00
feat(daemon): run sync passes on a worker pool
The loop thread schedules and sync.workers threads (default 4) run passes, so a slow or hanging fetch no longer holds up every other repo. A repo never has two passes at once; passes go only to idle workers, so pause and backoff behave as before. Visibility and merged-PR caches are shared without holding locks across forge requests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6e5bee1a95
commit
f16438fa02
7 files changed
+317
-127
No files matched your search
@@ -171,6 +171,10 @@ pub struct Sync {
|
||||
/// (`prune::default_protected`) and the default branch. See [`Sync::protected_branches`].
|
||||
#[serde(default)]
|
||||
pub prune_protected: Vec<String>,
|
||||
/// How many repos the daemon syncs at the same time (1 to 32). A repo never has two
|
||||
/// passes at once.
|
||||
#[serde(default = "default_workers")]
|
||||
pub workers: usize,
|
||||
}
|
||||
|
||||
impl Sync {
|
||||
@@ -194,6 +198,7 @@ impl Default for Sync {
|
||||
prune_merged: true,
|
||||
prune_disposable: default_disposable(),
|
||||
prune_protected: Vec::new(),
|
||||
workers: default_workers(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,6 +212,9 @@ pub struct ConfigRepo {
|
||||
fn yes() -> bool {
|
||||
true
|
||||
}
|
||||
fn default_workers() -> usize {
|
||||
4
|
||||
}
|
||||
fn default_debounce() -> u64 {
|
||||
2000
|
||||
}
|
||||
@@ -347,6 +355,12 @@ impl Config {
|
||||
));
|
||||
}
|
||||
}
|
||||
if !(1..=32).contains(&self.sync.workers) {
|
||||
return bad(format!(
|
||||
"sync.workers = {} must be between 1 and 32",
|
||||
self.sync.workers
|
||||
));
|
||||
}
|
||||
if let Some(d) = self
|
||||
.sync
|
||||
.prune_disposable
|
||||
|
||||
Reference in new issue
Block a user