Skip to content

Commit 4a278bc

Browse files
hdurand0710Gopher Bot
authored andcommitted
BUG/MEDIUM: default time suffix for stats refresh delay is seconds
It was milliseconds which should be seconds.
1 parent 0bb8c72 commit 4a278bc

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
@@ -1603,7 +1603,8 @@
16031603
"stats_realm": true,
16041604
"stats_realm_realm": "HAProxy\\\\ Statistics",
16051605
"stats_show_modules": true,
1606-
"stats_show_node_name": null
1606+
"stats_show_node_name": null,
1607+
"stats_refresh_delay": 10000
16071608
},
16081609
"tarpit_timeout": 2000,
16091610
"tcp_smart_accept": "enabled",

0 commit comments

Comments
 (0)