srijeet0406 commented on code in PR #7539:
URL: https://github.com/apache/trafficcontrol/pull/7539#discussion_r1212290354
##########
traffic_monitor/health/cache.go:
##########
@@ -130,11 +135,7 @@ func GetVitals(newResult *cache.Result, prevResult
*cache.Result, mc *tc.Traffic
newResult.Vitals.MaxKbpsOut += iface.Speed * 1000
}
- if prevResult != nil && prevResult.Vitals.BytesOut != 0 {
- elapsedTimeInSecs :=
float64(newResult.Time.UnixMilli()-prevResult.Time.UnixMilli()) / 1000
- if elapsedTimeInSecs == 0 {
- elapsedTimeInSecs = float64(prevResult.Time.UnixMilli()
/ 1000)
- }
+ if prevResult.Vitals.BytesOut != 0 {
Review Comment:
Same comment here.
##########
traffic_monitor/health/cache.go:
##########
@@ -114,11 +123,7 @@ func GetVitals(newResult *cache.Result, prevResult
*cache.Result, mc *tc.Traffic
MaxKbpsOut: iface.Speed * 1000,
}
- if prevResult != nil && prevResult.InterfaceVitals != nil &&
prevResult.InterfaceVitals[ifaceName].BytesOut != 0 {
- elapsedTimeInSecs :=
float64(newResult.Time.UnixMilli()-prevResult.Time.UnixMilli()) / 1000
- if elapsedTimeInSecs == 0 {
- elapsedTimeInSecs =
float64(prevResult.Time.UnixMilli() / 1000)
- }
+ if prevResult.InterfaceVitals != nil &&
prevResult.InterfaceVitals[ifaceName].BytesOut != 0 {
Review Comment:
`prevResult` can still be `nil` here, so I think we should keep that check
in here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]