Say the node tools are there, every minute (hq to-be 45 Phase 1, S11)
A machine whose node-engine is heard and whose runtime is gone is a machine nobody can ask anything, and nothing said so. The runtime now says on mesh.control.<node>.tools-alive, every minute, that it is there, with its interval and build; the controller raises tools-silent after three missed. Core NATS, like the host's heartbeat: a lost one is the next one. A heartbeat the bus refuses is logged when that starts and when it stops.
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/novox/mesh-tools/node-tools/internal/alive"
|
||||
"github.com/novox/mesh-tools/node-tools/internal/bus"
|
||||
"github.com/novox/mesh-tools/node-tools/internal/console"
|
||||
"github.com/novox/mesh-tools/node-tools/internal/runtime"
|
||||
@@ -54,6 +55,12 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatalf("node-tools: %v", err)
|
||||
}
|
||||
// And says it is there (novox/hq to-be 45 S11): the machine's runtime, on its machine's name. A
|
||||
// runtime on another credential — a module's own, in a test — is not the machine's.
|
||||
stopSaying := func() {}
|
||||
if cred.Module == runtimeModule && cred.Node != "" {
|
||||
stopSaying = alive.Keep(conn, cred.Node, alive.Every, log.Printf)
|
||||
}
|
||||
|
||||
listen := os.Getenv("MESH_CONSOLE_LISTEN")
|
||||
if listen == "" && cred.Module == runtimeModule {
|
||||
@@ -76,6 +83,7 @@ func main() {
|
||||
signals := make(chan os.Signal, 1)
|
||||
signal.Notify(signals, syscall.SIGTERM, syscall.SIGINT)
|
||||
<-signals
|
||||
stopSaying()
|
||||
stop()
|
||||
if up != nil {
|
||||
_ = up.Close()
|
||||
|
||||
Reference in New Issue
Block a user