putio: handle rate limit errors

For rate limit errors, "x-ratelimit-reset" header is now respected.
This commit is contained in:
Berkan Teber 2022-03-22 11:40:49 +03:00 committed by Nick Craig-Wood
parent 887cccb2c1
commit 6ea26b508a
5 changed files with 36 additions and 5 deletions

View file

@ -302,8 +302,8 @@ func (f *Fs) createUpload(ctx context.Context, name string, size int64, parentID
if err != nil {
return false, err
}
if resp.StatusCode != 201 {
return false, fmt.Errorf("unexpected status code from upload create: %d", resp.StatusCode)
if err := checkStatusCode(resp, 201); err != nil {
return shouldRetry(ctx, err)
}
location = resp.Header.Get("location")
if location == "" {