mesh-watcher names the self-check seat and its event from the seat's contract (B5d; ADR 0634 §1; issue 1966)
Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
@@ -24,11 +24,11 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/health"
|
||||
meshselfcheck "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshselfcheck"
|
||||
)
|
||||
|
||||
// HeartbeatEvent is the event's local name under the seat mesh-self-check.
|
||||
const HeartbeatEvent = health.EventChecked
|
||||
const HeartbeatEvent = meshselfcheck.EventChecked
|
||||
|
||||
// Beat is one heartbeat.
|
||||
type Beat struct {
|
||||
@@ -39,7 +39,7 @@ type Beat struct {
|
||||
}
|
||||
|
||||
// isHeartbeat says whether an envelope's key is the self-check's heartbeat.
|
||||
func isHeartbeat(key string) bool { return key == health.SelfCheckModule+"."+HeartbeatEvent }
|
||||
func isHeartbeat(key string) bool { return key == meshselfcheck.Seat+"."+HeartbeatEvent }
|
||||
|
||||
// DecodeBeat reads one heartbeat's body.
|
||||
func DecodeBeat(body []byte) (Beat, error) {
|
||||
|
||||
@@ -17,9 +17,9 @@ import (
|
||||
|
||||
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient"
|
||||
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient"
|
||||
meshselfcheck "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshselfcheck"
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
"git.novox.be/novox/mesh-sdk/go/delivery"
|
||||
"git.novox.be/novox/mesh-sdk/go/health"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/views"
|
||||
)
|
||||
@@ -121,7 +121,7 @@ func run(w *Watcher, l *listening, node string, placement *views.Reader) {
|
||||
}
|
||||
<-stdio.Served() // subscribed as soon as the runtime serves, never after a guessed wait: a heartbeat sent meanwhile is heard
|
||||
for wait := 2 * time.Second; ; wait = min(wait*2, time.Minute) {
|
||||
err := stdio.Subscribe(health.SelfCheckModule+".*", handle)
|
||||
err := stdio.Subscribe(meshselfcheck.Seat+".*", handle)
|
||||
if err == nil {
|
||||
l.set("listening")
|
||||
logf("[mesh-watcher] listening for the self-check's heartbeat; watching from %s", node)
|
||||
|
||||
@@ -15,3 +15,5 @@ require (
|
||||
golang.org/x/crypto v0.57.0 // indirect
|
||||
golang.org/x/sys v0.48.0 // indirect
|
||||
)
|
||||
|
||||
require git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshselfcheck v0.0.0-00010101000000-000000000000
|
||||
|
||||
Reference in New Issue
Block a user