unconscious/subconscious: use Option<AutoAgent> instead of placeholder
Previously, spawning an agent used std::mem::replace with an empty-name AutoAgent as placeholder. This caused ghost stats entries under "" when those placeholders accidentally got their stats logged. Now uses Option<AutoAgent> with .take() - the type honestly represents that the agent is unavailable while running. Panic recovery in subconscious now properly recreates the agent from its definition. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
33156d9ab3
commit
b94e056372
3 changed files with 37 additions and 23 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
|
@ -612,6 +612,7 @@ dependencies = [
|
|||
"dirs",
|
||||
"env_logger",
|
||||
"futures",
|
||||
"json5",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
|
@ -632,8 +633,8 @@ dependencies = [
|
|||
"json5",
|
||||
"libc",
|
||||
"log",
|
||||
"scopeguard",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue