compressio: do not schedule new I/Os when there is no worker (stream closed).

PiperOrigin-RevId: 217536677
Change-Id: Ib9a5a2542df12d0bc5592b91463ffd646e2ec295
This commit is contained in:
Zhaozhong Ni 2018-10-17 09:57:02 -07:00 committed by Shentubot
parent ba33a70e47
commit 9d17eba121
1 changed files with 2 additions and 2 deletions

View File

@ -323,10 +323,10 @@ func (p *pool) schedule(c *chunk, callback func(*chunk) error) error {
inputChan chan *chunk
outputChan chan result
)
if c != nil {
if c != nil && len(p.workers) != 0 {
inputChan = p.workers[(p.nextInput+1)%len(p.workers)].input
}
if callback != nil && p.nextOutput != p.nextInput {
if callback != nil && p.nextOutput != p.nextInput && len(p.workers) != 0 {
outputChan = p.workers[(p.nextOutput+1)%len(p.workers)].output
}
if inputChan == nil && outputChan == nil {