postgres: announce a consumer failed for minutes, and its recovery
A provider failed every consumer for a day and said so only in its journal (hq issue 179). The provisioner loop now emits provisioner.failing after five minutes without a success — create, check or secret — and repeats it every fifteen; provisioner.recovered on the next success, on withdrawal, and on the first success after a restart, so the controller can name it in status (hq ADR 0224).
This commit is contained in:
@@ -40,6 +40,14 @@ func main() {
|
||||
Receives: receives,
|
||||
Adapter: provisioner{pg: pg, announce: announce},
|
||||
Log: func(format string, args ...any) { fmt.Fprintf(os.Stderr, format+"\n", args...) },
|
||||
// A consumer failed for minutes is said on the bus, where the controller hears it and
|
||||
// `status` names it (novox/hq ADR 0224).
|
||||
Announce: func(event string, body map[string]any) {
|
||||
if err := stdio.Emit(event, body); err != nil {
|
||||
say("emit %s failed: %v", event, err)
|
||||
}
|
||||
},
|
||||
Node: os.Getenv("MESH_NODE"),
|
||||
}
|
||||
go h.Run(context.Background())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user