Skip to content

Commit

Permalink
[Bugfix] fix cleanup loop in language detection handler (#25274)
Browse files Browse the repository at this point in the history
  • Loading branch information
adel121 authored Apr 30, 2024
1 parent c8d4425 commit 2feb83d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmd/cluster-agent/api/v1/languagedetection/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ func (handler *languageDetectionHandler) startCleanupInBackground(ctx context.Co
go func() {
cleanupTicker := time.NewTicker(handler.cfg.cleanupPeriod)
defer cleanupTicker.Stop()
select {
case <-cleanupTicker.C:
handler.ownersLanguages.cleanExpiredLanguages(handler.wlm)
case <-ctx.Done():
break
for {
select {
case <-cleanupTicker.C:
handler.ownersLanguages.cleanExpiredLanguages(handler.wlm)
case <-ctx.Done():
break
}
}
}()

Expand Down

0 comments on commit 2feb83d

Please sign in to comment.