sched: Fix taskDone chan deadlock
This commit is contained in:
parent
b87142ec8e
commit
9af82f2d68
3
extern/sector-storage/sched_worker.go
vendored
3
extern/sector-storage/sched_worker.go
vendored
@ -475,6 +475,7 @@ func (sw *schedWorker) startProcessingTask(req *workerRequest) error {
|
|||||||
case sw.taskDone <- struct{}{}:
|
case sw.taskDone <- struct{}{}:
|
||||||
case <-sh.closing:
|
case <-sh.closing:
|
||||||
log.Warnf("scheduler closed while sending response (prepare error: %+v)", err)
|
log.Warnf("scheduler closed while sending response (prepare error: %+v)", err)
|
||||||
|
default: // there is a notification pending already
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
@ -496,6 +497,7 @@ func (sw *schedWorker) startProcessingTask(req *workerRequest) error {
|
|||||||
select {
|
select {
|
||||||
case sw.taskDone <- struct{}{}:
|
case sw.taskDone <- struct{}{}:
|
||||||
case <-sh.closing:
|
case <-sh.closing:
|
||||||
|
default: // there is a notification pending already
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do the work!
|
// Do the work!
|
||||||
@ -550,6 +552,7 @@ func (sw *schedWorker) startProcessingReadyTask(req *workerRequest) error {
|
|||||||
case sw.taskDone <- struct{}{}:
|
case sw.taskDone <- struct{}{}:
|
||||||
case <-sh.closing:
|
case <-sh.closing:
|
||||||
log.Warnf("scheduler closed while sending response (prepare error: %+v)", err)
|
log.Warnf("scheduler closed while sending response (prepare error: %+v)", err)
|
||||||
|
default: // there is a notification pending already
|
||||||
}
|
}
|
||||||
|
|
||||||
w.lk.Unlock()
|
w.lk.Unlock()
|
||||||
|
Loading…
Reference in New Issue
Block a user