cmd/vnet: omit log spam when backend status hasn't changed

Updates #13038

Change-Id: I9cc67cf18ba44ff66ba03cda486d5e111e395ce7
pull/13252/head
Brad Fitzpatrick 3 months ago committed by Brad Fitzpatrick
parent e5fd36ad78
commit 475ab1fb67

@ -89,6 +89,7 @@ func main() {
http.ListenAndServe(":8080", rp) http.ListenAndServe(":8080", rp)
}() }()
go func() { go func() {
var last string
getStatus := func() { getStatus := func() {
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel() defer cancel()
@ -97,8 +98,11 @@ func main() {
log.Printf("NodeStatus: %v", err) log.Printf("NodeStatus: %v", err)
return return
} }
if st.BackendState != last {
last = st.BackendState
log.Printf("NodeStatus: %v", logger.AsJSON(st)) log.Printf("NodeStatus: %v", logger.AsJSON(st))
} }
}
for { for {
time.Sleep(5 * time.Second) time.Sleep(5 * time.Second)
//continue //continue

Loading…
Cancel
Save