mirror of
https://github.com/niusmallnan/steve.git
synced 2025-07-16 15:41:10 +00:00
Prevent write on closed channel
This commit is contained in:
parent
a91d90251f
commit
6bb3915906
@ -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)
|
||||
}()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user