Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

dropbox: make batcher retry all errors so it doesn't exit early

Nick Craig-Wood5ee646f264a9
diff --git a/backend/dropbox/batcher.go b/backend/dropbox/batcher.go
index c6a8e0999..11303de81 100644
--- a/backend/dropbox/batcher.go
+++ b/backend/dropbox/batcher.go
@@ -147,19 +147,23 @@ func (b *batcher) finishBatchJobStatus(ctx context.Context, launchBatchStatus *f
return shouldRetry(ctx, err)
})
if err != nil {
- return nil, errors.Wrap(err, "wait for batch completion: check failed")
- }
- if batchStatus.Tag == "complete" {
- break
+ fs.Debugf(b.f, "Wait for batch: sleeping for %v after error: %v: try %d/%d", sleepTime, err, try, maxTries)
+ } else {
+ if batchStatus.Tag == "complete" {
+ return batchStatus.Complete, nil
+ }
+ fs.Debugf(b.f, "Wait for batch: sleeping for %v after status: %q: try %d/%d", sleepTime, batchStatus.Tag, try, maxTries)
}
- fs.Debugf(b.f, "Sleeping for %v to wait for batch to complete: %q: try %d/%d", sleepTime, batchStatus.Tag, try, maxTries)
time.Sleep(sleepTime)
sleepTime *= 2
if sleepTime > time.Second {
sleepTime = time.Second
}
}
- return batchStatus.Complete, nil
+ if err == nil {
+ err = errors.New("batch didn't complete")
+ }
+ return nil, errors.Wrapf(err, "wait for batch failed after %d tries", maxTries)
}
// commit a batch