From abbe805737da8bb2f37320190e990eec5e39417c Mon Sep 17 00:00:00 2001 From: Jonathan Crowther Date: Wed, 13 Mar 2024 19:41:21 -0400 Subject: [PATCH] Change which object needs DeepCopy --- pkg/resources/counts/buffer.go | 2 +- pkg/resources/counts/counts.go | 13 +------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/pkg/resources/counts/buffer.go b/pkg/resources/counts/buffer.go index 9578f593..0f97d14a 100644 --- a/pkg/resources/counts/buffer.go +++ b/pkg/resources/counts/buffer.go @@ -49,7 +49,7 @@ func debounceCounts(result chan types.APIEvent, input chan Count) { } case <-t.C: if currentCount != nil { - result <- toAPIEvent(*currentCount.DeepCopy()) + result <- toAPIEvent(*currentCount) currentCount = nil } } diff --git a/pkg/resources/counts/counts.go b/pkg/resources/counts/counts.go index c3d75e98..d4e7d9d9 100644 --- a/pkg/resources/counts/counts.go +++ b/pkg/resources/counts/counts.go @@ -48,17 +48,6 @@ type Count struct { Counts map[string]ItemCount `json:"counts"` } -func (c *Count) DeepCopy() *Count { - r := *c - if r.Counts != nil { - r.Counts = map[string]ItemCount{} - for k, v := range c.Counts { - r.Counts[k] = *v.DeepCopy() - } - } - return &r -} - type Summary struct { Count int `json:"count,omitempty"` States map[string]int `json:"states,omitempty"` @@ -192,7 +181,7 @@ func (s *Store) Watch(apiOp *types.APIRequest, schema *types.APISchema, w types. counts[schema.ID] = itemCount changedCount := map[string]ItemCount{ - schema.ID: itemCount, + schema.ID: *itemCount.DeepCopy(), } result <- Count{