feat: P1-3 add heartbeat keep-alive goroutine

- add heartbeat.go with heartbeatIntervalSecs var, SetHeartbeatInterval, runHeartbeat (no build tag, CGO-free)
- add heartbeat_test.go with 5 tests covering interval validation and goroutine lifecycle
- add StartHeartbeat to clib.go (CGO impl calling xcecli_heartbeat)
- remove SetHeartbeatInterval stub from stub.go (now real code in heartbeat.go)
- remove TestSetHeartbeatInterval_StubNoOp from stub_funcs_test.go
- call SetHeartbeatInterval in OnClusterUpdated to track backend-pushed interval
- call backend.StartHeartbeat in cmd/main.go after backend registration
This commit is contained in:
Rongsong Shen 2026-04-17 14:12:40 +00:00
parent bc3103a6d5
commit ffc5b20cdb
7 changed files with 125 additions and 12 deletions

View file

@ -64,6 +64,7 @@ func (h *DefaultHandler) OnClusterUpdated(incoming *models.ClusterInfo) {
existing.Vcpus = incoming.Vcpus
existing.InactiveHeartbeatCount = incoming.InactiveHeartbeatCount
store.Clusters.Put(existing.ClusterName, existing)
SetHeartbeatInterval(incoming.HeartbeatInterval)
}
func (h *DefaultHandler) OnResourceUpdated(res *models.ResourceDefinitionInfo) {