mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-15 17:51:20 +00:00
If the channel send is blocked then there is already an update queued, and there is no point waiting to queue another one. In profiling, the channel send in monitor.go has been seen to "leak" goroutines as the channel is not being read from fast enough, but the root cause is not known. Signed-off-by: Thomas Hartland <thomas.hartland@diamond.ac.uk> Co-authored-by: Thomas Hartland <11710676+tghartland@users.noreply.github.com>
This commit is contained in:
parent
a7cf6e7c05
commit
4d685c798f
2 changed files with 12 additions and 3 deletions
|
@ -116,8 +116,12 @@ func (t *Monitor) Run(register *Register, certRenewer *tls.CertRenewer, eventGen
|
|||
// update namespaceSelector every 30 seconds
|
||||
go func() {
|
||||
if register.autoUpdateWebhooks {
|
||||
logger.V(4).Info("updating webhook configurations for namespaceSelector with latest kyverno ConfigMap")
|
||||
register.UpdateWebhookChan <- true
|
||||
select {
|
||||
case register.UpdateWebhookChan <- true:
|
||||
logger.V(4).Info("updating webhook configurations for namespaceSelector with latest kyverno ConfigMap")
|
||||
default:
|
||||
logger.V(4).Info("skipped sending update webhook signal as the channel was blocking")
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
|
@ -217,7 +217,12 @@ func (wrc *Register) UpdateWebhookConfigurations(configHandler config.Configurat
|
|||
if retry {
|
||||
go func() {
|
||||
time.Sleep(1 * time.Second)
|
||||
wrc.UpdateWebhookChan <- true
|
||||
select {
|
||||
case wrc.UpdateWebhookChan <- true:
|
||||
return
|
||||
default:
|
||||
return
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue