From d10c6f88cd6147a60a1100927bf7e694ae7c6e37 Mon Sep 17 00:00:00 2001 From: Bob Stevens <35038919+restevens402@users.noreply.github.com> Date: Sat, 10 Aug 2024 08:34:03 -0700 Subject: [PATCH] resolving comments in PR --- pkg/workers/send_work.go | 10 +--------- pkg/workers/worker_selection.go | 5 ++--- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/pkg/workers/send_work.go b/pkg/workers/send_work.go index ad0743b9..5f39a3d4 100644 --- a/pkg/workers/send_work.go +++ b/pkg/workers/send_work.go @@ -80,15 +80,7 @@ func tryWorkersRoundRobin(node *masa.OracleNode, workers []Worker, message *mess logrus.Info("Attempting local worker") return tryWorker(node, *localWorker, message, responseCollector) } - - // If no workers are available, create a local worker as last resort - logrus.Warn("No workers available, creating last resort local worker") - lastResortLocalWorker := Worker{ - IsLocal: true, - NodeData: pubsub.NodeData{PeerId: node.Host.ID()}, - Node: node, - } - return tryWorker(node, lastResortLocalWorker, message, responseCollector) + return false } func tryWorker(node *masa.OracleNode, worker Worker, message *messages.Work, responseCollector chan *pubsub2.Message) bool { diff --git a/pkg/workers/worker_selection.go b/pkg/workers/worker_selection.go index faddb849..735e5e65 100644 --- a/pkg/workers/worker_selection.go +++ b/pkg/workers/worker_selection.go @@ -134,7 +134,6 @@ func (r *roundRobinIterator) Next() Worker { if hasLocalWorker { return localWorker } - - // This should never happen if HasNext() is checked before calling Next() - panic("No workers available") + logrus.Error("No workers available") + return Worker{} }