Fix UI lag: try_lock on unconscious mutex, don't re-log restored nodes

The unconscious trigger holds the tokio mutex during heavy sync work
(store load, graph build, agent creation), blocking the UI tick which
needs the same lock for snapshots. Fix: try_lock in the UI — skip
the update if the trigger is running.

Also: restore_from_log was re-logging every restored node back to the
log file via push()'s auto-log. Added push_no_log() for restore path.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-04-09 01:07:55 -04:00
parent b7e053edc3
commit 6529aba069
3 changed files with 11 additions and 12 deletions

View file

@ -377,20 +377,13 @@ async fn run(
idle_state.decay_ewma();
app.update_idle(&idle_state);
app.agent_state = mind.subconscious_snapshots().await;
{
if let Ok(mut unc) = mind.unconscious.try_lock() {
let toggles: Vec<String> = app.agent_toggles.drain(..).collect();
if !toggles.is_empty() {
let mut sub = mind.subconscious.lock().await;
let mut unc = mind.unconscious.lock().await;
for name in &toggles {
if sub.toggle(name).is_none() {
unc.toggle(name).await;
}
for name in &toggles {
if mind.subconscious.lock().await.toggle(name).is_none() {
unc.toggle(name).await;
}
}
}
{
let unc = mind.unconscious.lock().await;
app.unconscious_state = unc.snapshots();
app.graph_health = unc.graph_health.clone();
}