Skip to content

Commit

Permalink
resolving comments in PR
Browse files Browse the repository at this point in the history
  • Loading branch information
restevens402 committed Aug 10, 2024
1 parent 12db5b5 commit d10c6f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
10 changes: 1 addition & 9 deletions pkg/workers/send_work.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 2 additions & 3 deletions pkg/workers/worker_selection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
}

0 comments on commit d10c6f8

Please sign in to comment.