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 }