From 44040ca684f743227347f958b1457f1b1ebacc84 Mon Sep 17 00:00:00 2001 From: Shelikhoo Date: Sat, 19 Jun 2021 11:24:02 +0100 Subject: [PATCH] return zero length value when observer is not found --- app/router/strategy_leastload.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/router/strategy_leastload.go b/app/router/strategy_leastload.go index 76172f7fc..afe9da521 100644 --- a/app/router/strategy_leastload.go +++ b/app/router/strategy_leastload.go @@ -144,13 +144,15 @@ func (s *LeastLoadStrategy) getNodes(candidates []string, maxRTT time.Duration) if s.settings.ObserverTag == "" { observeResult, err := s.observer.GetObservation(s.ctx) if err != nil { - newError("cannot get observation").Base(err) + newError("cannot get observation").Base(err).WriteToLog() + return make([]*node, 0) } result = observeResult } else { observeResult, err := common.Must2(s.observer.(features.TaggedFeatures).GetFeaturesByTag(s.settings.ObserverTag)).(extension.Observatory).GetObservation(s.ctx) if err != nil { - newError("cannot get observation").Base(err) + newError("cannot get observation").Base(err).WriteToLog() + return make([]*node, 0) } result = observeResult }