Skip to content
This repository was archived by the owner on Dec 17, 2025. It is now read-only.

Commit d310961

Browse files
committed
fixup! fix: avoid resources lock contention utilizing channel
resolve PR's comments: https://github.com/argoproj/gitops-engine/pull/629\#pullrequestreview-2425207583
1 parent 809ba43 commit d310961

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pkg/cache/cluster.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ func (c *clusterCache) recordEvent(event watch.EventType, un *unstructured.Unstr
13001300
}
13011301

13021302
func (c *clusterCache) processEvents() {
1303-
log := c.log.WithValues("fn", "processItems")
1303+
log := c.log.WithValues("functionName", "processItems")
13041304
log.V(1).Info("Start processing events")
13051305

13061306
c.lock.Lock()
@@ -1313,12 +1313,12 @@ func (c *clusterCache) processEvents() {
13131313

13141314
for {
13151315
select {
1316-
case em, ok := <-ch:
1316+
case evMeta, ok := <-ch:
13171317
if !ok {
1318-
log.V(1).Info("Event processing channel closed, finish processing")
1318+
log.V(2).Info("Event processing channel closed, finish processing")
13191319
return
13201320
}
1321-
eventMetas = append(eventMetas, em)
1321+
eventMetas = append(eventMetas, evMeta)
13221322
case <-ticker.C:
13231323
if len(eventMetas) > 0 {
13241324
c.processEventsBatch(eventMetas)
@@ -1329,7 +1329,7 @@ func (c *clusterCache) processEvents() {
13291329
}
13301330

13311331
func (c *clusterCache) processEventsBatch(eventMetas []eventMeta) {
1332-
log := c.log.WithValues("fn", "processEventsBatch")
1332+
log := c.log.WithValues("functionName", "processEventsBatch")
13331333
start := time.Now()
13341334
c.lock.Lock()
13351335
log.V(1).Info("Lock acquired (ms)", "duration", time.Since(start).Milliseconds())

0 commit comments

Comments
 (0)