From 1597e8590644e761642aecb05a73e7640a79abb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 29 Nov 2022 11:45:31 +0100 Subject: [PATCH] sched: Address review --- storage/sealer/sched_assigner_common.go | 1 + storage/sealer/sched_test.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/storage/sealer/sched_assigner_common.go b/storage/sealer/sched_assigner_common.go index 3aad91cc3..bf92dbf15 100644 --- a/storage/sealer/sched_assigner_common.go +++ b/storage/sealer/sched_assigner_common.go @@ -67,6 +67,7 @@ func (a *AssignerCommon) TrySched(sh *Scheduler) { partDone := metrics.Timer(sh.mctx, metrics.SchedAssignerCandidatesDuration) defer func() { + // call latest value of partDone in case we error out somewhere partDone() }() diff --git a/storage/sealer/sched_test.go b/storage/sealer/sched_test.go index 812c906e4..2eed1ce73 100644 --- a/storage/sealer/sched_test.go +++ b/storage/sealer/sched_test.go @@ -589,12 +589,16 @@ func TestSched(t *testing.T) { type slowishSelector bool func (s slowishSelector) Ok(ctx context.Context, task sealtasks.TaskType, spt abi.RegisteredSealProof, a SchedWorker) (bool, bool, error) { + // note: we don't care about output here, just the time those calls take + // (selector Ok/Cmp is called in the scheduler) _, _ = a.Paths(ctx) _, _ = a.TaskTypes(ctx) return bool(s), false, nil } func (s slowishSelector) Cmp(ctx context.Context, task sealtasks.TaskType, a, b SchedWorker) (bool, error) { + // note: we don't care about output here, just the time those calls take + // (selector Ok/Cmp is called in the scheduler) _, _ = a.Paths(ctx) return true, nil }