summaryrefslogtreecommitdiffhomepage
path: root/pkg/compressio
diff options
context:
space:
mode:
authorZhaozhong Ni <nzz@google.com>2018-10-17 09:57:02 -0700
committerShentubot <shentubot@google.com>2018-10-17 09:57:57 -0700
commit9d17eba121dab054c21307b9696ba7471dff4a74 (patch)
tree2483cbf98c30198b139b5f002fd0d1980e4544e1 /pkg/compressio
parentba33a70e47492f9cc8e3550ed795c892553ac1d4 (diff)
compressio: do not schedule new I/Os when there is no worker (stream closed).
PiperOrigin-RevId: 217536677 Change-Id: Ib9a5a2542df12d0bc5592b91463ffd646e2ec295
Diffstat (limited to 'pkg/compressio')
-rw-r--r--pkg/compressio/compressio.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/compressio/compressio.go b/pkg/compressio/compressio.go
index b4c1c70d9..667f17c5c 100644
--- a/pkg/compressio/compressio.go
+++ b/pkg/compressio/compressio.go
@@ -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 {