Catch another pool check (#347)
diff --git a/go/pkg/cas/client.go b/go/pkg/cas/client.go
index 67825cb..19d136b 100644
--- a/go/pkg/cas/client.go
+++ b/go/pkg/cas/client.go
@@ -280,7 +280,8 @@
streamBufSize = int(c.Config.ByteStreamWrite.MaxSizeBytes)
}
c.streamBufs.New = func() interface{} {
- return make([]byte, streamBufSize)
+ buf := make([]byte, streamBufSize)
+ return &buf
}
}
diff --git a/go/pkg/cas/upload.go b/go/pkg/cas/upload.go
index 560e76d..1eb2bf9 100644
--- a/go/pkg/cas/upload.go
+++ b/go/pkg/cas/upload.go
@@ -764,7 +764,7 @@
req.ResourceName = fmt.Sprintf("%s/uploads/%s/blobs/%s/%d", u.InstanceName, uuid.New(), digest.Hash, digest.SizeBytes)
}
- buf := u.streamBufs.Get().([]byte)
+ buf := u.streamBufs.Get().(*[]byte)
defer u.streamBufs.Put(buf)
chunkLoop:
@@ -776,14 +776,14 @@
// Read the next chunk from the pipe.
// Use ReadFull to ensure we aren't sending tiny blobs over RPC.
- n, err := io.ReadFull(r, buf)
+ n, err := io.ReadFull(r, *buf)
switch {
case err == io.EOF || err == io.ErrUnexpectedEOF:
req.FinishWrite = true
case err != nil:
return err
}
- req.Data = buf[:n] // must limit by `:n` in ErrUnexpectedEOF case
+ req.Data = (*buf)[:n] // must limit by `:n` in ErrUnexpectedEOF case
// Send the chunk.
withTimeout(func() {