Skip to content

Commit 3697b83

Browse files
Don't print more than 1 error per second when running out of workers
1 parent b6735c7 commit 3697b83

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cmd/node-termination-handler.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,14 @@ func main() {
222222
log.Info().Msg("Started watching for event cancellations")
223223

224224
var wg sync.WaitGroup
225+
225226
for range time.NewTicker(1 * time.Second).C {
226227
select {
227228
case <-signalChan:
228229
// Exit interruption loop if a SIGTERM is received or the channel is closed
229230
break
230231
default:
232+
EventLoop:
231233
for event, ok := interruptionEventStore.GetActiveEvent(); ok; event, ok = interruptionEventStore.GetActiveEvent() {
232234
select {
233235
case interruptionEventStore.Workers <- 1:
@@ -243,7 +245,7 @@ func main() {
243245
go drainOrCordonIfNecessary(interruptionEventStore, event, *node, nthConfig, nodeMetadata, metrics, recorder, &wg)
244246
default:
245247
log.Warn().Msg("all workers busy, waiting")
246-
break
248+
break EventLoop
247249
}
248250
}
249251
}

0 commit comments

Comments
 (0)