Skip to content

Commit 2601bfa

Browse files
authored
Correctly finish app streaming call when app watch requests stopped (#18)
1 parent d61a8e6 commit 2601bfa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

server/application/application.go

+3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ func (s *Server) Watch(q *ApplicationQuery, ws ApplicationService_WatchServer) e
7171
if err != nil {
7272
return err
7373
}
74+
done := make(chan bool)
7475
go func() {
7576
for next := range w.ResultChan() {
7677
app := *next.Object.(*appv1.Application)
@@ -84,10 +85,12 @@ func (s *Server) Watch(q *ApplicationQuery, ws ApplicationService_WatchServer) e
8485
}
8586
}
8687
}
88+
done <- true
8789
}()
8890
select {
8991
case <-ws.Context().Done():
9092
w.Stop()
93+
case <-done:
9194
}
9295
return nil
9396
}

0 commit comments

Comments
 (0)