13973: Tweak test for inheriting CR priority
[arvados.git] / services / keepstore / s3_volume.go
index b5a1c97b48c1b8269ae6384c1716d93cd129500c..bdab58927bdc243605b8cf1d7e95b34d2f610272 100644 (file)
@@ -429,7 +429,7 @@ func (v *S3Volume) Put(ctx context.Context, loc string, block []byte) error {
        case <-ctx.Done():
                theConfig.debugLogf("%s: taking PutReader's input away: %s", v, ctx.Err())
                // Our pipe might be stuck in Write(), waiting for
-               // io.Copy() to read. If so, un-stick it. This means
+               // PutReader() to read. If so, un-stick it. This means
                // PutReader will get corrupt data, but that's OK: the
                // size and MD5 won't match, so the write will fail.
                go io.Copy(ioutil.Discard, bufr)
@@ -438,6 +438,8 @@ func (v *S3Volume) Put(ctx context.Context, loc string, block []byte) error {
                theConfig.debugLogf("%s: abandoning PutReader goroutine", v)
                return ctx.Err()
        case <-ready:
+               // Unblock pipe in case PutReader did not consume it.
+               io.Copy(ioutil.Discard, bufr)
                return v.translateError(err)
        }
 }
@@ -850,7 +852,7 @@ func (v *S3Volume) EmptyTrash() {
        }
 
        var wg sync.WaitGroup
-       todo := make(chan *s3.Key)
+       todo := make(chan *s3.Key, theConfig.EmptyTrashWorkers)
        for i := 0; i < 1 || i < theConfig.EmptyTrashWorkers; i++ {
                wg.Add(1)
                go func() {