Skip to content

Commit

Permalink
return nil when errors occur
Browse files Browse the repository at this point in the history
  • Loading branch information
dfawley committed May 15, 2023
1 parent d965902 commit 82ef531
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/cache/v3/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ func superset(names map[string]bool, resources map[string]types.ResourceWithTTL)
return nil
}

// CreateWatch returns a watch for an xDS request.
// CreateWatch returns a watch for an xDS request. A nil function may be
// returned if an error occurs.
func (cache *snapshotCache) CreateWatch(request *Request, streamState stream.StreamState, value chan Response) func() {
nodeID := cache.hash.ID(request.Node)

Expand Down Expand Up @@ -365,6 +366,7 @@ func (cache *snapshotCache) CreateWatch(request *Request, streamState stream.Str
if err := cache.respond(context.Background(), request, value, resources, version, false); err != nil {
cache.log.Errorf("failed to send a response for %s%v to nodeID %q: %s", request.TypeUrl,
request.ResourceNames, nodeID, err)
return nil
}
return func() {}
}
Expand All @@ -387,6 +389,7 @@ func (cache *snapshotCache) CreateWatch(request *Request, streamState stream.Str
if err := cache.respond(context.Background(), request, value, resources, version, false); err != nil {
cache.log.Errorf("failed to send a response for %s%v to nodeID %q: %s", request.TypeUrl,
request.ResourceNames, nodeID, err)
return nil
}

return func() {}
Expand Down

0 comments on commit 82ef531

Please sign in to comment.