forked from kent/consciousness
unconscious: move health refresh outside lock too
refresh_health() was doing Store::load() + compute_graph_health() while holding the Unconscious lock, causing 12 second stalls. Split into needs_health_refresh() (quick check) and set_health() (quick store), with the slow I/O happening outside the lock. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
f40d8cfa9d
commit
ac6f1e9294
2 changed files with 18 additions and 14 deletions
|
|
@ -346,6 +346,14 @@ impl Mind {
|
|||
s.unc_idle = true;
|
||||
}
|
||||
loop {
|
||||
// Phase 0: health check outside lock (slow I/O)
|
||||
let needs_health = unc.lock().await.needs_health_refresh();
|
||||
if needs_health {
|
||||
if let Ok(store) = crate::store::Store::load() {
|
||||
let health = crate::subconscious::daemon::compute_graph_health(&store);
|
||||
unc.lock().await.set_health(health);
|
||||
}
|
||||
}
|
||||
// Phase 1: quick work under lock
|
||||
let to_spawn = {
|
||||
let mut guard = unc.lock().await;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue