This repository has been archived on 2022-08-17. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
dex/pkg/time/backoff.go
2015-08-18 11:26:57 -07:00

15 lines
185 B
Go

package time
import (
"time"
)
func ExpBackoff(prev, max time.Duration) time.Duration {
if prev == 0 {
return time.Second
}
if prev > max/2 {
return max
}
return 2 * prev
}