From f0fd53281bf02fc4efef87516de8b2b3001cf524 Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 26 Oct 2026 11:37:14 +0100 Subject: [PATCH] The vault says once why a look of the bus module's have adopted nothing, and again when it changes (ADR 0547 clause 9) --- modules/mesh-vault/cmd/mesh-vault/main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/mesh-vault/cmd/mesh-vault/main.go b/modules/mesh-vault/cmd/mesh-vault/main.go index 9ae740e1..c74e0449 100644 --- a/modules/mesh-vault/cmd/mesh-vault/main.go +++ b/modules/mesh-vault/cmd/mesh-vault/main.go @@ -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 })