From 34e6de07fb2cddbabd60ab03823dea182ee27b8a Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Tue, 14 Jul 2020 13:28:21 -0700 Subject: [PATCH] Make notifier optional --- pkg/stores/proxy/proxy_store.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pkg/stores/proxy/proxy_store.go b/pkg/stores/proxy/proxy_store.go index 481f700..a404922 100644 --- a/pkg/stores/proxy/proxy_store.go +++ b/pkg/stores/proxy/proxy_store.go @@ -303,15 +303,17 @@ func (s *Store) listAndWatch(apiOp *types.APIRequest, k8sClient dynamic.Resource watcher.Stop() }() - eg.Go(func() error { - for rel := range s.notifier.OnInboundRelationshipChange(ctx, schema, apiOp.Namespace) { - obj, err := s.byID(apiOp, schema, rel.Name) - if err == nil { - result <- s.toAPIEvent(apiOp, schema, watch.Modified, obj) + if s.notifier != nil { + eg.Go(func() error { + for rel := range s.notifier.OnInboundRelationshipChange(ctx, schema, apiOp.Namespace) { + obj, err := s.byID(apiOp, schema, rel.Name) + if err == nil { + result <- s.toAPIEvent(apiOp, schema, watch.Modified, obj) + } } - } - return fmt.Errorf("closed") - }) + return fmt.Errorf("closed") + }) + } eg.Go(func() error { for event := range watcher.ResultChan() {