From f09500f289f4c1525b9ef6b0406683617c7e2c93 Mon Sep 17 00:00:00 2001 From: Sergey Stepanov Date: Sun, 17 Nov 2024 19:55:14 +0300 Subject: [PATCH] Check slots for direct workers --- pkg/coordinator/hub.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/pkg/coordinator/hub.go b/pkg/coordinator/hub.go index 4b8215919..af9bfca83 100644 --- a/pkg/coordinator/hub.go +++ b/pkg/coordinator/hub.go @@ -1,7 +1,6 @@ package coordinator import ( - "bytes" "encoding/base64" "fmt" "net/http" @@ -299,16 +298,20 @@ func (h *Hub) findWorkerById(id string, useAllWorkers bool) *Worker { if w.Id() == com.NilUid { continue } - if useAllWorkers { - if uid == w.Id() { - return w - } - } else { - // select any worker on the same machine when workers are grouped on the client - if bytes.Equal(uid.Machine(), w.Id().Machine()) { - return w - } + + if uid == w.Id() && w.HasSlot() { + return w } + //if useAllWorkers { + // if uid == w.Id() { + // return w + // } + //} else { + // // select any worker on the same machine when workers are grouped on the client + // if bytes.Equal(uid.Machine(), w.Id().Machine()) { + // return w + // } + //} } return nil