Skip to content

Commit f529edd

Browse files
committed
update backoff policy
1 parent b0bc8cf commit f529edd

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pkg/server/server.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/zeriontech/sidecache/pkg/lock"
1111
"io"
1212
"io/ioutil"
13-
"math"
1413
"net/http"
1514
"net/http/httputil"
1615
"net/url"
@@ -252,9 +251,9 @@ func (server CacheServer) ReorderQueryString(url *url.URL) string {
252251
}
253252

254253
func (server CacheServer) GetBackoff(attempt int) time.Duration {
255-
multiplier := 1
256-
if attempt%2 != 0 {
257-
multiplier = 5
254+
if attempt < 10 {
255+
return 100 * time.Millisecond
256+
} else {
257+
return 500 * time.Millisecond
258258
}
259-
return time.Duration(multiplier*int(math.Pow(10, float64(attempt/2+1)))) * time.Millisecond
260259
}

0 commit comments

Comments
 (0)