mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 16:34:30 +01:00
fs: Async buffer: use ReadFill to fill the chunks and increase to 1MB
This commit is contained in:
parent
493da54113
commit
7fa687b3e1
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user