Skip to content

Commit

Permalink
only update SCADA metadata if status changes (#18585)
Browse files Browse the repository at this point in the history
* only update SCADA metadata if status changes

* add changelog entry
  • Loading branch information
ccapurso authored and AnPucel committed Jan 14, 2023
1 parent 7eaff16 commit 2d96f33
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
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

0 comments on commit 2d96f33

Please sign in to comment.