Do not panic if the type is not api.Status (an error scenario). Closes #2105 (#2106)

This commit is contained in:
Alex Collins 2019-08-06 00:24:22 -07:00 committed by Alexander Matyushentsev
parent c47cc25690
commit e3e4ae5d2e

View file

@ -518,8 +518,12 @@ func (s *Server) Watch(q *application.ApplicationQuery, ws application.Applicati
done := make(chan bool)
go func() {
for next := range w.ResultChan() {
a := *next.Object.(*appv1.Application)
_ = sendIfPermitted(a, next.Type)
a, ok := next.Object.(*appv1.Application)
if ok {
_ = sendIfPermitted(*a, next.Type)
} else {
break
}
}
logCtx.Info("k8s application watch event channel closed")
close(done)