Documentation
¶
Index ¶
Constants ¶
const ( // StreamBaseDelay is the base delay for stream reconnect backoff. StreamBaseDelay = 1 * time.Second // StreamMaxDelay caps stream reconnect backoff delay. StreamMaxDelay = 30 * time.Second // StreamBackoffFactor is the exponential multiplier for stream reconnect backoff. StreamBackoffFactor = 2.0 // StreamSyncMaxAttempts bounds synchronous subscribe/send reconnect attempts. StreamSyncMaxAttempts = 5 )
Variables ¶
This section is empty.
Functions ¶
func GRPCDialOptions ¶
func GRPCDialOptions(l *zerolog.Logger, enabled bool) []grpc.DialOption
GRPCDialOptions returns gRPC dial options that install unary and stream retry interceptors. When enabled is false, it returns nil.
func SleepStreamBackoff ¶ added in v0.93.2
SleepStreamBackoff waits for the stream reconnect backoff delay or until ctx is cancelled.
func StreamBackoffDelay ¶ added in v0.93.2
StreamBackoffDelay returns a full-jitter delay for the given stream reconnect attempt.
Types ¶
type RestDoer ¶
type RestDoer struct {
// contains filtered or unexported fields
}
RestDoer retries eligible bodyless GET and HEAD requests.
func NewRestDoer ¶
NewRestDoer wraps inner with REST read retry behavior.
type StreamDecision ¶ added in v0.93.2
type StreamDecision int
StreamDecision describes how a stream error should be handled.
const ( // StreamDecisionRetry indicates the stream should reconnect after a transient failure. StreamDecisionRetry StreamDecision = iota // StreamDecisionStop indicates the stream should exit without reconnecting. StreamDecisionStop // StreamDecisionNoProgress indicates reconnect would not advance the stream. StreamDecisionNoProgress )
func ClassifyStreamError ¶ added in v0.93.2
func ClassifyStreamError(ctx context.Context, err error) StreamDecision
ClassifyStreamError maps a stream error to a reconnect decision: Retry for transient gRPC codes (listen loops reconnect indefinitely); Stop for permanent/cancelled errors; NoProgress for EOF, non-status, and other unknown errors (retries only until the no-progress cap).