sched: Fix tests

This commit is contained in:
Łukasz Magiera 2020-09-02 17:37:19 +02:00
parent 7fe8580da5
commit 5a2b439773

View File

@ -774,14 +774,19 @@ func (sh *scheduler) dropWorker(wid WorkerID) {
} }
func (sh *scheduler) workerCleanup(wid WorkerID, w *workerHandle) { func (sh *scheduler) workerCleanup(wid WorkerID, w *workerHandle) {
if !w.cleanupStarted { select {
case <-w.closingMgr:
default:
close(w.closingMgr) close(w.closingMgr)
} }
sh.workersLk.Unlock()
select { select {
case <-w.closedMgr: case <-w.closedMgr:
case <-time.After(time.Second): case <-time.After(time.Second):
log.Errorf("timeout closing worker manager goroutine %d", wid) log.Errorf("timeout closing worker manager goroutine %d", wid)
} }
sh.workersLk.Lock()
if !w.cleanupStarted { if !w.cleanupStarted {
w.cleanupStarted = true w.cleanupStarted = true