From 5f1a27d52b305deaad707683c9247bafc948044e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 28 Apr 2020 12:31:08 +0200 Subject: [PATCH] sched: Address review --- sched.go | 5 +++++ selector_task.go | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sched.go b/sched.go index 2d988d082..ffaad211d 100644 --- a/sched.go +++ b/sched.go @@ -293,6 +293,11 @@ func (sh *scheduler) assignWorker(wid WorkerID, w *workerHandle, req *workerRequ }) sh.workersLk.Unlock() + + // This error should always be nil, since nothing is setting it, but just to be safe: + if err != nil { + log.Errorf("error executing worker (withResources): %+v", err) + } }() return nil diff --git a/selector_task.go b/selector_task.go index f1f4b7770..5e67ad665 100644 --- a/selector_task.go +++ b/selector_task.go @@ -27,7 +27,7 @@ func (s *taskSelector) Ok(ctx context.Context, task sealtasks.TaskType, whnd *wo return supported, nil } -func (s *taskSelector) Cmp(ctx context.Context, task sealtasks.TaskType, a, b *workerHandle) (bool, error) { +func (s *taskSelector) Cmp(ctx context.Context, _ sealtasks.TaskType, a, b *workerHandle) (bool, error) { atasks, err := a.w.TaskTypes(ctx) if err != nil { return false, xerrors.Errorf("getting supported worker task types: %w", err) @@ -40,7 +40,7 @@ func (s *taskSelector) Cmp(ctx context.Context, task sealtasks.TaskType, a, b *w return len(atasks) < len(btasks), nil // prefer workers which can do less } - return a.info.Hostname > a.info.Hostname, nil // TODO: Better fallback strategy + return a.info.Hostname > b.info.Hostname, nil // TODO: Better fallback strategy } var _ WorkerSelector = &allocSelector{}