Documentation
¶
Overview ¶
Package retryx 提供 SDK 无关的重试策略、退避和可重试判断。
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShouldRetry ¶
ShouldRetry reports whether err is a kernel error marked retryable.
Types ¶
type RetryPolicy ¶
func DefaultRetryPolicy ¶
func DefaultRetryPolicy() RetryPolicy
func (RetryPolicy) Delay ¶
func (p RetryPolicy) Delay(attempt int) time.Duration
Example ¶
package main
import (
"time"
"github.com/ZoneCNH/kernel/retryx"
)
func main() {
policy := retryx.RetryPolicy{MaxAttempts: 3, BaseDelay: 10 * time.Millisecond, MaxDelay: time.Second}
_ = policy.Delay(2)
}
Output:
func (RetryPolicy) DelayWithJitter ¶
func (RetryPolicy) Validate ¶
func (p RetryPolicy) Validate() error
Click to show internal directories.
Click to hide internal directories.