Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only update SCADA metadata if status changes #18585

Merged
merged 2 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/18585.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
hcp/connectivity: Only update SCADA session metadata if status changes
```
8 changes: 7 additions & 1 deletion vault/hcp_link/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ func (h *HCPLinkVault) start() error {
// API. In addition, it checks replication status of Vault and sets that in
// Scada provider metadata status
func (h *HCPLinkVault) reportStatus() {
var currentNodeStatus string

ticker := time.NewTicker(SetLinkStatusCadence)
defer ticker.Stop()
for {
Expand Down Expand Up @@ -249,7 +251,11 @@ func (h *HCPLinkVault) reportStatus() {
nodeStatus = activeStatus
}

h.linkConfig.SCADAProvider.UpdateMeta(map[string]string{metaDataNodeStatus: nodeStatus})
// Only update SCADA session metadata if status has changed
if currentNodeStatus != nodeStatus {
currentNodeStatus = nodeStatus
h.linkConfig.SCADAProvider.UpdateMeta(map[string]string{metaDataNodeStatus: currentNodeStatus})
}
}
}
}
Expand Down