gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/util/backoff/backoff.go (about) 1 // Package backoff provides backoff functionality 2 package backoff 3 4 import ( 5 "math" 6 "time" 7 ) 8 9 func Do(attempts int) time.Duration { 10 if attempts == 0 { 11 return time.Duration(0) 12 } 13 return time.Duration(math.Pow(10, float64(attempts))) * time.Millisecond 14 }