1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-15 14:58:52 +00:00

DeepCopy the count before sending it as APIEvent

This commit is contained in:
Jonathan Crowther
2024-03-01 09:48:20 -05:00
parent 641178e7cb
commit 0e74495395
3 changed files with 5 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import (
"time"
"github.com/rancher/apiserver/pkg/types"
"golang.design/x/reflect"
)
// debounceDuration determines how long events will be held before they are sent to the consumer
@@ -49,7 +50,7 @@ func debounceCounts(result chan types.APIEvent, input chan Count) {
}
case <-t.C:
if currentCount != nil {
result <- toAPIEvent(*currentCount)
result <- toAPIEvent(reflect.DeepCopy(*currentCount))
currentCount = nil
}
}