workers: fix panics with schedQueue
This commit is contained in:
parent
66d71d9974
commit
09c9fcce00
@ -59,7 +59,7 @@ type Manager struct {
|
|||||||
workerFree chan workerID
|
workerFree chan workerID
|
||||||
closing chan struct{}
|
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) {
|
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),
|
workerFree: make(chan workerID),
|
||||||
closing: make(chan struct{}),
|
closing: make(chan struct{}),
|
||||||
|
|
||||||
|
schedQueue: list.New(),
|
||||||
|
|
||||||
Prover: prover,
|
Prover: prover,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +99,9 @@ func (m *Manager) onWorkerFreed(wid workerID) {
|
|||||||
if pe == nil {
|
if pe == nil {
|
||||||
pe = m.schedQueue.Front()
|
pe = m.schedQueue.Front()
|
||||||
}
|
}
|
||||||
|
if pe == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
e = pe
|
e = pe
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user