mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-21 02:33:38 +00:00
Remove debugging code not needed for the push request.
This commit is contained in:
@@ -18,8 +18,6 @@ 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"
|
||||||
@@ -109,34 +107,12 @@ func (storage *GCDStorage) shouldRetry(threadIndex int, err error) (bool, error)
|
|||||||
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 {
|
LOG_DEBUG("GCD_RETRY", "Thread: %3d. Message: %s. Retrying after %6.2f seconds. Current backoff: %6.2f. Number of retries: %2d.", threadIndex, message, delay, storage.backoffs[threadIndex], storage.backoffsRetries[threadIndex])
|
||||||
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)
|
|
||||||
}
|
|
||||||
time.Sleep(time.Duration(delay * float64(time.Second)))
|
time.Sleep(time.Duration(delay * float64(time.Second)))
|
||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func findCallerChain() string {
|
|
||||||
callerStack := ""
|
|
||||||
pc := make([]uintptr, 15)
|
|
||||||
n := runtime.Callers(1, pc)
|
|
||||||
frames := runtime.CallersFrames(pc[:n])
|
|
||||||
|
|
||||||
for {
|
|
||||||
frame, more := frames.Next()
|
|
||||||
if strings.Contains(frame.File, "runtime/") {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
callerStack += "->" + frame.Function
|
|
||||||
if !more {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return callerStack
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
logic for said calculus is here: https://stackoverflow.com/questions/1527803/generating-random-whole-numbers-in-javascript-in-a-specific-range
|
logic for said calculus is here: https://stackoverflow.com/questions/1527803/generating-random-whole-numbers-in-javascript-in-a-specific-range
|
||||||
chose 0.1*thread number as a minimum sleep time
|
chose 0.1*thread number as a minimum sleep time
|
||||||
|
|||||||
Reference in New Issue
Block a user