From 32de8712437b8eb3e3273e889fff9d43aa08714e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 14 Oct 2022 15:58:25 +0200 Subject: [PATCH] fix: post worker sched: Don't check worker session in a busy loop --- storage/sealer/sched_post.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/storage/sealer/sched_post.go b/storage/sealer/sched_post.go index 64986726f09..1055227d81f 100644 --- a/storage/sealer/sched_post.go +++ b/storage/sealer/sched_post.go @@ -169,6 +169,12 @@ func (ps *poStScheduler) watch(wid storiface.WorkerID, worker *WorkerHandle) { }() for { + select { + case <-heartbeatTimer.C: + case <-worker.closingMgr: + return + } + sctx, scancel := context.WithTimeout(ctx, paths.HeartbeatInterval/2) curSes, err := worker.workerRpc.Session(sctx) scancel() @@ -177,12 +183,7 @@ func (ps *poStScheduler) watch(wid storiface.WorkerID, worker *WorkerHandle) { log.Warnw("failed to check worker session", "error", err) ps.disable(wid) - select { - case <-heartbeatTimer.C: - continue - case <-worker.closingMgr: - return - } + continue } if storiface.WorkerID(curSes) != wid {