diff --git a/fs/accounting.go b/fs/accounting.go index 217fe6eed..40926f72f 100644 --- a/fs/accounting.go +++ b/fs/accounting.go @@ -348,7 +348,7 @@ func NewAccount(in io.ReadCloser, obj Object) *Account { // // If the file is above a certain size it adds an Async reader func NewAccountSizeNameWithBuffer(in io.ReadCloser, size int64, name string) *Account { - const bufSize = 128 * 1024 + const bufSize = 1024 * 1024 var buffers int if size >= int64(Config.BufferSize) { buffers = int(int64(Config.BufferSize) / bufSize) diff --git a/fs/buffer.go b/fs/buffer.go index 724654b45..8a7a51431 100644 --- a/fs/buffer.go +++ b/fs/buffer.go @@ -183,7 +183,7 @@ func (b *buffer) isEmpty() bool { // Any error encountered during the read is returned. func (b *buffer) read(rd io.Reader) error { var n int - n, b.err = rd.Read(b.buf[0:b.size]) + n, b.err = ReadFill(rd, b.buf[0:b.size]) b.buf = b.buf[0:n] b.offset = 0 return b.err diff --git a/fs/buffer_test.go b/fs/buffer_test.go index 5528e9992..466e7d6be 100644 --- a/fs/buffer_test.go +++ b/fs/buffer_test.go @@ -20,7 +20,7 @@ func TestAsyncReader(t *testing.T) { var dst = make([]byte, 100) n, err := ar.Read(dst) - require.NoError(t, err) + assert.Equal(t, io.EOF, err) assert.Equal(t, 10, n) n, err = ar.Read(dst)