From c1888035acbc2aacca379d2e58034b981fa59521 Mon Sep 17 00:00:00 2001 From: damonlau27 Date: Wed, 22 Apr 2020 16:18:02 +0800 Subject: [PATCH] prefer remote worker --- sched.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sched.go b/sched.go index 9a60a415f..fb689663a 100644 --- a/sched.go +++ b/sched.go @@ -117,7 +117,8 @@ func (m *Manager) maybeSchedRequest(req *workerRequest) (*workerResponse, error) tried := 0 - for _, id := range req.accept { + for i := len(req.accept) - 1; i >= 0; i-- { + id := req.accept[i] w, ok := m.workers[id] if !ok { log.Warnf("requested worker %d is not in scheduler", id)