Update split SDK to 6.0.2 to fix sync bug (#17060)
* Update split SDK to 6.0.2 to fix sync bug * Vendor and tidy
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
fa2ecad0a9
Коммит
aba00a3cfd
35
vendor/github.com/splitio/go-toolkit/v4/backoff/backoff.go
сгенерированный
поставляемый
Обычный файл
35
vendor/github.com/splitio/go-toolkit/v4/backoff/backoff.go
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,35 @@
|
||||
package backoff
|
||||
|
||||
import (
|
||||
"math"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Interface is the backoff interface
|
||||
type Interface interface {
|
||||
Next() time.Duration
|
||||
Reset()
|
||||
}
|
||||
|
||||
// Impl implements the Backoff interface
|
||||
type Impl struct {
|
||||
base int64
|
||||
current int64
|
||||
}
|
||||
|
||||
// Next returns how long to wait and updates the current count
|
||||
func (b *Impl) Next() time.Duration {
|
||||
current := atomic.AddInt64(&b.current, 1)
|
||||
return time.Duration(math.Pow(float64(b.base), float64(current))) * time.Second
|
||||
}
|
||||
|
||||
// Reset sets the current count to 0
|
||||
func (b *Impl) Reset() {
|
||||
atomic.StoreInt64(&b.current, 0)
|
||||
}
|
||||
|
||||
// New creates a new Backoffer
|
||||
func New() *Impl {
|
||||
return &Impl{base: 2}
|
||||
}
|
||||
Ссылка в новой задаче
Block a user