stats -- Clamp number of rotations to sane value and prevent from going into (very long) loop
This commit is contained in:
parent
182fa37e5f
commit
0440ef016a
3
stats.go
3
stats.go
|
@ -107,6 +107,9 @@ func isConnRefused(err error) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func statsRotate(periodic *periodicStats, now time.Time, rotations int64) {
|
func statsRotate(periodic *periodicStats, now time.Time, rotations int64) {
|
||||||
|
if rotations > statsHistoryElements {
|
||||||
|
rotations = statsHistoryElements
|
||||||
|
}
|
||||||
// calculate how many times we should rotate
|
// calculate how many times we should rotate
|
||||||
for r := int64(0); r < rotations; r++ {
|
for r := int64(0); r < rotations; r++ {
|
||||||
for key, values := range periodic.Entries {
|
for key, values := range periodic.Entries {
|
||||||
|
|
Loading…
Reference in New Issue