Make notifier optional

This commit is contained in:
Darren Shepherd 2020-07-14 13:28:21 -07:00
parent f4ef308923
commit 34e6de07fb

View File

@ -303,15 +303,17 @@ func (s *Store) listAndWatch(apiOp *types.APIRequest, k8sClient dynamic.Resource
watcher.Stop() watcher.Stop()
}() }()
eg.Go(func() error { if s.notifier != nil {
for rel := range s.notifier.OnInboundRelationshipChange(ctx, schema, apiOp.Namespace) { eg.Go(func() error {
obj, err := s.byID(apiOp, schema, rel.Name) for rel := range s.notifier.OnInboundRelationshipChange(ctx, schema, apiOp.Namespace) {
if err == nil { obj, err := s.byID(apiOp, schema, rel.Name)
result <- s.toAPIEvent(apiOp, schema, watch.Modified, obj) if err == nil {
result <- s.toAPIEvent(apiOp, schema, watch.Modified, obj)
}
} }
} return fmt.Errorf("closed")
return fmt.Errorf("closed") })
}) }
eg.Go(func() error { eg.Go(func() error {
for event := range watcher.ResultChan() { for event := range watcher.ResultChan() {