1
0
mirror of https://github.com/gilbertchen/duplicacy synced 2025-12-23 03:33:15 +00:00

Better handling of B2 authorization failures

This commit fixed 2 issues wrt Backblaze B2 authorization:
* every thread may call b2_authorize_account at the same time when there
are 401 errors
* if B2 has a login outage, then all threads will call b2_authorize_account
repeatedly without delay

A simple solution is to limit one b2_authorize_account call to once every
30 second regardless of how many threads there are.  If the call to
b2_authorize_account is not allowed, the random exponential backoff will
be performed.
This commit is contained in:
Gilbert Chen
2019-06-13 22:43:07 -04:00
parent 4da7f7b6f9
commit 045be3905b
3 changed files with 21 additions and 8 deletions

View File

@@ -19,7 +19,7 @@ func CreateB2Storage(accountID string, applicationKey string, bucket string, sto
client := NewB2Client(accountID, applicationKey, storageDir, threads)
err = client.AuthorizeAccount(0)
err, _ = client.AuthorizeAccount(0)
if err != nil {
return nil, err
}