1
0
mirror of https://github.com/gilbertchen/duplicacy synced 2025-12-14 23:33:18 +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

@@ -50,7 +50,7 @@ func TestB2Client(t *testing.T) {
b2Client.TestMode = true
err := b2Client.AuthorizeAccount(0)
err, _ := b2Client.AuthorizeAccount(0)
if err != nil {
t.Errorf("Failed to authorize the b2 account: %v", err)
return