Skip to content

Commit b3cb79e

Browse files
committed
fixed build
Signed-off-by: alecholmez <[email protected]>
1 parent a602b4b commit b3cb79e

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

pkg/server/sotw/v3/server.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,6 @@ func (s *server) process(str stream.Stream, reqCh <-chan *discovery.DiscoveryReq
206206
} else {
207207
// No pre-existing watch exists, let's create one.
208208
// We need to precompute the watches first then open a watch in the cache.
209-
watches.responders[typeURL] = &watch{}
210-
w = watches.responders[typeURL]
211-
watches.recompute(s.ctx, reqCh)
212-
213209
watches.addWatch(typeURL, &watch{
214210
cancel: s.cache.CreateWatch(req, streamState, responder),
215211
response: responder,
@@ -221,6 +217,7 @@ func (s *server) process(str stream.Stream, reqCh <-chan *discovery.DiscoveryReq
221217
default:
222218
// Channel n -> these are the dynamic list of responders that correspond to the stream request typeURL
223219
if !ok {
220+
// Receiver channel was closed. TODO(jpeach): probably cancel the watch or something?
224221
return status.Errorf(codes.Unavailable, "resource watch %d -> failed", index)
225222
}
226223

pkg/server/sotw/v3/watches.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ func (w *watches) close() {
4040

4141
// recomputeWatches rebuilds the known list of dynamic channels if needed
4242
func (w *watches) recompute(ctx context.Context, req <-chan *discovery.DiscoveryRequest) {
43-
w.cases = w.cases[0:]
43+
w.cases = w.cases[:0] // Clear the existing cases while retaining capacity.
44+
4445
w.cases = append(w.cases,
4546
reflect.SelectCase{
4647
Dir: reflect.SelectRecv,

0 commit comments

Comments
 (0)