mirror of
https://github.com/rclone/rclone
synced 2024-11-05 01:42:31 +01:00
storj: fix "uplink: too many requests" errors when uploading to the same file
Storj has a rate limit of 1 per second when uploading to the same file. This was being tripped by the integration tests. This patch fixes it by detecting the error and sleeping for 1 second before retrying. See: https://github.com/storj/uplink/issues/149
This commit is contained in:
parent
f7665300c0
commit
4b4198522d
@ -589,6 +589,14 @@ func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options .
|
||||
return nil, err
|
||||
}
|
||||
err = fserrors.RetryError(errors.New("bucket was not available, now created, the upload must be retried"))
|
||||
} else if errors.Is(err, uplink.ErrTooManyRequests) {
|
||||
// Storj has a rate limit of 1 per second of uploading to the same file.
|
||||
// This produces ErrTooManyRequests here, so we wait 1 second and retry.
|
||||
//
|
||||
// See: https://github.com/storj/uplink/issues/149
|
||||
fs.Debugf(f, "uploading too fast - sleeping for 1 second: %v", err)
|
||||
time.Sleep(time.Second)
|
||||
err = fserrors.RetryError(err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user