The vault says once why a look of the bus module's have adopted nothing, and again when it changes (ADR 0547 clause 9)

This commit is contained in:
2026-10-26 11:37:14 +01:00
parent fb039250f6
commit f0fd53281b
+8 -1
View File
@@ -71,13 +71,20 @@ func watchHandings(env *Env) bool {
if env.Vault == nil {
return true
}
// The have changes at every look of the bus module's health: why nothing was adopted is said once, and again when
// it changes.
var said string
err := stdio.State(HaveRead).Watch("*."+BusModule, func(c stdio.StateChange) error {
if c.Op == "delete" || len(c.Value) == 0 {
return nil
}
node := strings.TrimSuffix(c.Key, "."+BusModule)
if _, err := env.Vault.AdoptFrom(node, c.Value, "the watch of "+HaveRead, false); err != nil {
_, err := env.Vault.AdoptFrom(node, c.Value, "the watch of "+HaveRead, false)
if line := fmt.Sprint(err); err != nil && line != said {
say("adopted nothing from %s: %v", c.Key, err)
said = line
} else if err == nil {
said = ""
}
return nil
})