Unverified Commit 7694d474 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #193 from libp2p/feat/backoff-cleanup

don't expire backoffs until 2x backoff period
parents 1c0adc36 b5d70683
......@@ -196,7 +196,11 @@ func (db *DialBackoff) cleanup() {
for p, e := range db.entries {
good := false
for _, backoff := range e {
if now.Before(backoff.until) {
backoffTime := BackoffBase + BackoffCoef*time.Duration(backoff.tries*backoff.tries)
if backoffTime > BackoffMax {
backoffTime = BackoffMax
}
if now.Before(backoff.until.Add(backoffTime)) {
good = true
break
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment