Skip to content

Commit

Permalink
fixed build
Browse files Browse the repository at this point in the history
Signed-off-by: alecholmez <[email protected]>
  • Loading branch information
alecholmez committed Dec 6, 2021
1 parent a602b4b commit b3cb79e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 1 addition & 4 deletions pkg/server/sotw/v3/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,6 @@ func (s *server) process(str stream.Stream, reqCh <-chan *discovery.DiscoveryReq
} else {
// No pre-existing watch exists, let's create one.
// We need to precompute the watches first then open a watch in the cache.
watches.responders[typeURL] = &watch{}
w = watches.responders[typeURL]
watches.recompute(s.ctx, reqCh)

watches.addWatch(typeURL, &watch{
cancel: s.cache.CreateWatch(req, streamState, responder),
response: responder,
Expand All @@ -221,6 +217,7 @@ func (s *server) process(str stream.Stream, reqCh <-chan *discovery.DiscoveryReq
default:
// Channel n -> these are the dynamic list of responders that correspond to the stream request typeURL
if !ok {
// Receiver channel was closed. TODO(jpeach): probably cancel the watch or something?
return status.Errorf(codes.Unavailable, "resource watch %d -> failed", index)
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/server/sotw/v3/watches.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ func (w *watches) close() {

// recomputeWatches rebuilds the known list of dynamic channels if needed
func (w *watches) recompute(ctx context.Context, req <-chan *discovery.DiscoveryRequest) {
w.cases = w.cases[0:]
w.cases = w.cases[:0] // Clear the existing cases while retaining capacity.

w.cases = append(w.cases,
reflect.SelectCase{
Dir: reflect.SelectRecv,
Expand Down

0 comments on commit b3cb79e

Please sign in to comment.