Skip to content

Commit 1b3adb7

Browse files
authored
pkg/settings/limits: prevent double close (#1608)
1 parent c1f318b commit 1b3adb7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/settings/limits/updater.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (u *updater[N]) updateLoop(cre contexts.CRE) {
8282
var c <-chan time.Time
8383
if u.subFn != nil {
8484
updates, cancelSub = u.subFn(contexts.WithCRE(ctx, cre))
85-
defer cancelSub()
85+
defer func() { cancelSub() }() // extra func wrapper is required to ensure we get the final cancelSub value
8686
// opt: poll now to initialize
8787
} else {
8888
t := services.TickerConfig{}.NewTicker(pollPeriod)

0 commit comments

Comments
 (0)