mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-18 01:03:25 +00:00
Run goimports for the good looks
This commit is contained in:
@@ -18,11 +18,12 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
"google.golang.org/api/drive/v3"
|
"google.golang.org/api/drive/v3"
|
||||||
"google.golang.org/api/googleapi"
|
"google.golang.org/api/googleapi"
|
||||||
"runtime"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GCDStorage struct {
|
type GCDStorage struct {
|
||||||
@@ -107,9 +108,9 @@ func (storage *GCDStorage) shouldRetry(threadIndex int, err error) (bool, error)
|
|||||||
storage.backoffs[threadIndex] = LIMIT_BACKOFF_TIME
|
storage.backoffs[threadIndex] = LIMIT_BACKOFF_TIME
|
||||||
storage.backoffsRetries[threadIndex] += 1
|
storage.backoffsRetries[threadIndex] += 1
|
||||||
}
|
}
|
||||||
delay := storage.backoffs[threadIndex] * rand.Float64() + storage.backoffs[threadIndex]*rand.Float64()
|
delay := storage.backoffs[threadIndex]*rand.Float64() + storage.backoffs[threadIndex]*rand.Float64()
|
||||||
if storage.backoffs[threadIndex] >= LIMIT_BACKOFF_TIME {
|
if storage.backoffs[threadIndex] >= LIMIT_BACKOFF_TIME {
|
||||||
callerChain:=findCallerChain()
|
callerChain := findCallerChain()
|
||||||
LOG_INFO("GCD_RETRY", "Thread: %3d. Message:%s. Retrying after %6.2f seconds. Current backoff: %6.2f. Number of retries: %2d. caller chain: %s", threadIndex, message, delay, storage.backoffs[threadIndex], storage.backoffsRetries[threadIndex], callerChain)
|
LOG_INFO("GCD_RETRY", "Thread: %3d. Message:%s. Retrying after %6.2f seconds. Current backoff: %6.2f. Number of retries: %2d. caller chain: %s", threadIndex, message, delay, storage.backoffs[threadIndex], storage.backoffsRetries[threadIndex], callerChain)
|
||||||
}
|
}
|
||||||
time.Sleep(time.Duration(delay * float64(time.Second)))
|
time.Sleep(time.Duration(delay * float64(time.Second)))
|
||||||
@@ -321,13 +322,13 @@ func CreateGCDStorage(tokenFile string, storagePath string, threads int) (storag
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
storage = &GCDStorage {
|
storage = &GCDStorage{
|
||||||
service: service,
|
service: service,
|
||||||
numberOfThreads: threads,
|
numberOfThreads: threads,
|
||||||
idCache: make(map[string]string),
|
idCache: make(map[string]string),
|
||||||
idCacheLock: &sync.Mutex{},
|
idCacheLock: &sync.Mutex{},
|
||||||
backoffs: make([]float64, threads),
|
backoffs: make([]float64, threads),
|
||||||
backoffsRetries:make([]int, threads),
|
backoffsRetries: make([]int, threads),
|
||||||
}
|
}
|
||||||
|
|
||||||
for b := range storage.backoffs {
|
for b := range storage.backoffs {
|
||||||
|
|||||||
Reference in New Issue
Block a user