Skip to content

Commit

Permalink
Use recover
Browse files Browse the repository at this point in the history
  • Loading branch information
krhitesh7 committed Nov 14, 2024
1 parent 303657a commit 6b280e2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/cache/v3/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -1016,9 +1016,12 @@ func (cache *snapshotCache) respondDelta(ctx context.Context, snapshot ResourceS
cache.log.Debugf("node: %s, sending delta response for typeURL %s with resources: %v removed resources: %v with wildcard: %t",
request.GetNode().GetId(), request.GetTypeUrl(), GetResourceWithTTLNames(resp.Resources), resp.RemovedResources, state.IsWildcard())
}
if value == nil {
return nil, nil
}

defer func() {
if r := recover(); r != nil {
fmt.Println("Tried to send on a closed channel")
}
}()
select {
case value <- resp:
return resp, nil
Expand Down

0 comments on commit 6b280e2

Please sign in to comment.