From 6bb3915906eac4bf2490df8735529b32ecc3e97a Mon Sep 17 00:00:00 2001 From: Jake Hyde Date: Wed, 2 Mar 2022 19:19:02 -0500 Subject: [PATCH] Prevent write on closed channel --- pkg/summarycache/summarycache.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/summarycache/summarycache.go b/pkg/summarycache/summarycache.go index 5c53069..326bacd 100644 --- a/pkg/summarycache/summarycache.go +++ b/pkg/summarycache/summarycache.go @@ -80,6 +80,7 @@ func (s *SummaryCache) OnInboundRelationshipChange(ctx context.Context, schema * s.cbs[id] = cb go func() { + defer close(ret) for rel := range cb { if rel.Kind == kind && rel.APIVersion == apiVersion && @@ -94,7 +95,6 @@ func (s *SummaryCache) OnInboundRelationshipChange(ctx context.Context, schema * s.Lock() defer s.Unlock() close(cb) - defer close(ret) delete(s.cbs, id) }()