1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
From: Mathias Gibbens <gibmat@debian.org>
Description: Fix build failure on 32bit systems
Forwarded: https://github.com/lestrrat-go/backoff/pull/36
diff --git a/controller.go b/controller.go
index 1d6c721..16ab8f9 100644
--- a/controller.go
+++ b/controller.go
@@ -10,22 +10,22 @@ type controller struct {
ctx context.Context
cancel func()
ig IntervalGenerator
- maxRetries int
+ maxRetries int64
mu *sync.RWMutex
next chan struct{} // user-facing channel
resetTimer chan time.Duration
- retries int
+ retries int64
timer *time.Timer
}
func newController(ctx context.Context, ig IntervalGenerator, options ...ControllerOption) *controller {
cctx, cancel := context.WithCancel(ctx) // DO NOT fire this cancel here
- maxRetries := 10
+ maxRetries := int64(10)
for _, option := range options {
switch option.Ident() {
case identMaxRetries{}:
- maxRetries = option.Value().(int)
+ maxRetries = option.Value().(int64)
}
}
diff --git a/options.go b/options.go
index f288f99..beba9b9 100644
--- a/options.go
+++ b/options.go
@@ -76,7 +76,7 @@ func (*commonOption) exponentialOption() {}
// of each policy.
//
// This option can be passed to all policy constructors except for NullPolicy
-func WithMaxRetries(v int) ControllerOption {
+func WithMaxRetries(v int64) ControllerOption {
return &controllerOption{option.New(identMaxRetries{}, v)}
}
|