mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-22 13:20:29 +01:00
Performance optimization for sshStorage (#313)
* Performance optimization for sshStorage * go fmt
This commit is contained in:
parent
84990ed6bd
commit
58573e6733
@ -81,7 +81,11 @@ func NewStorageBackend(opts Config, logFunc storage.Log) (storage.Backend, error
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sftpClient, err := sftp.NewClient(sshClient)
|
||||
sftpClient, err := sftp.NewClient(sshClient,
|
||||
sftp.UseConcurrentReads(true),
|
||||
sftp.UseConcurrentWrites(true),
|
||||
sftp.MaxConcurrentRequestsPerFile(64),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("NewStorageBackend: error creating sftp client: %w", err)
|
||||
}
|
||||
@ -117,7 +121,7 @@ func (b *sshStorage) Copy(file string) error {
|
||||
}
|
||||
defer destination.Close()
|
||||
|
||||
chunk := make([]byte, 1000000)
|
||||
chunk := make([]byte, 1e9)
|
||||
for {
|
||||
num, err := source.Read(chunk)
|
||||
if err == io.EOF {
|
||||
|
Loading…
Reference in New Issue
Block a user