fix: P1-3 address heartbeat timer leak, test drain, and store consistency
- COR-001: drain runHeartbeat goroutine via done channel before test returns, eliminating race against concurrent SetHeartbeatInterval tests - COR-002: replace time.After with time.NewTimer + defer t.Stop() + t.Reset() to prevent timer goroutine leaks on context cancellation - COR-005: guard HeartbeatInterval store write with > 0 check in OnClusterUpdated, keeping store consistent with SetHeartbeatInterval's zero-ignore semantics
This commit is contained in:
parent
ffc5b20cdb
commit
0a3de8b040
3 changed files with 16 additions and 9 deletions
|
|
@ -60,7 +60,9 @@ func (h *DefaultHandler) OnHostConfigUpdated(incoming *models.HostInfo) {
|
|||
func (h *DefaultHandler) OnClusterUpdated(incoming *models.ClusterInfo) {
|
||||
existing, _ := store.Clusters.Get(incoming.ClusterName)
|
||||
existing.ClusterName = incoming.ClusterName
|
||||
existing.HeartbeatInterval = incoming.HeartbeatInterval
|
||||
if incoming.HeartbeatInterval > 0 {
|
||||
existing.HeartbeatInterval = incoming.HeartbeatInterval
|
||||
}
|
||||
existing.Vcpus = incoming.Vcpus
|
||||
existing.InactiveHeartbeatCount = incoming.InactiveHeartbeatCount
|
||||
store.Clusters.Put(existing.ClusterName, existing)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue