From 41476d04a2755451cc7606635880a98da81b5e76 Mon Sep 17 00:00:00 2001 From: xuu Date: Mon, 2 Oct 2023 11:26:14 -0600 Subject: [PATCH] fix: null pointer when unable to startu peerfinder --- app/peerfinder/service.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/peerfinder/service.go b/app/peerfinder/service.go index a661c0c..d63e550 100644 --- a/app/peerfinder/service.go +++ b/app/peerfinder/service.go @@ -91,17 +91,17 @@ func (s *service) Run(ctx context.Context) (err error) { subRes, e := s.es.EventStream().Subscribe(ctx, queueResults, 0) errs = multierr.Append(errs, e) + if errs != nil { + return errs + } + defer func() { ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second) defer cancel() - err = multierr.Combine(errs, subReq.Close(ctx), subRes.Close(ctx)) + err = multierr.Combine(err, subReq.Close(ctx), subRes.Close(ctx)) }() - if errs != nil { - return errs - } - for { var events event.Events select {