1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-05 07:26:55 +00:00

drop events when queue size is 0 (#5994)

Signed-off-by: ShutingZhao <shuting@nirmata.com>

Signed-off-by: ShutingZhao <shuting@nirmata.com>
This commit is contained in:
shuting 2023-01-13 16:41:38 +08:00 committed by GitHub
parent cd7b1f5035
commit 45fe02a989
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -96,7 +96,7 @@ func (gen *Generator) Add(infos ...Info) {
logger := gen.log
logger.V(3).Info("generating events", "count", len(infos))
if gen.queue.Len() > gen.maxQueuedEvents {
if gen.maxQueuedEvents == 0 || gen.queue.Len() > gen.maxQueuedEvents {
logger.V(2).Info("exceeds the event queue limit, dropping the event", "maxQueuedEvents", gen.maxQueuedEvents, "current size", gen.queue.Len())
return
}