ExponentialBackoffStrategy 指数退避策略 重启间隔逐渐增加
| 174 | // ExponentialBackoffStrategy 指数退避策略 |
| 175 | // 重启间隔逐渐增加 |
| 176 | type ExponentialBackoffStrategy struct { |
| 177 | InitialDelay time.Duration |
| 178 | MaxDelay time.Duration |
| 179 | MaxRestarts int |
| 180 | Decider Decider |
| 181 | |
| 182 | mu sync.Mutex |
| 183 | currentDelay time.Duration |
| 184 | restartCount int |
| 185 | } |
| 186 | |
| 187 | // NewExponentialBackoffStrategy 创建指数退避策略 |
| 188 | func NewExponentialBackoffStrategy(initialDelay, maxDelay time.Duration, maxRestarts int, decider Decider) *ExponentialBackoffStrategy { |
nothing calls this directly
no outgoing calls
no test coverage detected