Skip to content

Commit 58f4ef8

Browse files
committed
BUG/MEDIUM: default time suffix for stats refresh delay is seconds
It was milliseconds which should be seconds.
1 parent 76f149a commit 58f4ef8

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

configuration/configuration.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ func (s *SectionParser) statsOptions() interface{} { //nolint:gocognit
10841084
opt.StatsMaxconn = mc.Value
10851085
case *stats.Refresh:
10861086
if v.Delay != "" {
1087-
opt.StatsRefreshDelay = misc.ParseTimeout(v.Delay)
1087+
opt.StatsRefreshDelay = misc.ParseTimeoutDefaultSeconds(v.Delay)
10881088
}
10891089
case *stats.ShowNode:
10901090
opt.StatsShowNodeName = misc.StringP(v.Name)
@@ -2574,7 +2574,7 @@ func (s *SectionObject) statsOptions(field reflect.Value) error {
25742574
}
25752575
if opt.StatsRefreshDelay != nil {
25762576
s := &stats.Refresh{
2577-
Delay: strconv.FormatInt(*opt.StatsRefreshDelay, 10),
2577+
Delay: misc.SerializeTime(*opt.StatsRefreshDelay, s.Options.PreferredTimeSuffix),
25782578
}
25792579
ss = append(ss, s)
25802580
}

test/configuration_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,7 @@ frontend test
679679
stats auth admin2:AdMiN1234
680680
stats show-modules
681681
stats realm HAProxy\\ Statistics
682+
stats refresh 10
682683
email-alert from srv01@example.com
683684
email-alert to problems@example.com
684685
email-alert level warning

test/expected/structured.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,8 @@
16061606
"stats_realm": true,
16071607
"stats_realm_realm": "HAProxy\\\\ Statistics",
16081608
"stats_show_modules": true,
1609-
"stats_show_node_name": null
1609+
"stats_show_node_name": null,
1610+
"stats_refresh_delay": 10000
16101611
},
16111612
"tarpit_timeout": 2000,
16121613
"tcp_smart_accept": "enabled",

0 commit comments

Comments
 (0)