workers: fix panics with schedQueue

This commit is contained in:
Łukasz Magiera 2020-03-22 21:45:12 +01:00
parent 66d71d9974
commit 09c9fcce00
2 changed files with 6 additions and 1 deletions

View File

@ -59,7 +59,7 @@ type Manager struct {
workerFree chan workerID
closing chan struct{}
schedQueue list.List // List[*workerRequest]
schedQueue *list.List // List[*workerRequest]
}
func New(ls stores.LocalStorage, si stores.SectorIndex, cfg *sectorbuilder.Config, urls URLs, ca api.Common) (*Manager, error) {
@ -97,6 +97,8 @@ func New(ls stores.LocalStorage, si stores.SectorIndex, cfg *sectorbuilder.Confi
workerFree: make(chan workerID),
closing: make(chan struct{}),
schedQueue: list.New(),
Prover: prover,
}

View File

@ -99,6 +99,9 @@ func (m *Manager) onWorkerFreed(wid workerID) {
if pe == nil {
pe = m.schedQueue.Front()
}
if pe == nil {
break
}
e = pe
continue
}