package utils

import "github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs/internal/utils"

Index

Functions

func Retry

func Retry(ctx context.Context, eventName log.Event, prefix func() string, o exported.RetryOptions, fn func(ctx context.Context, callbackArgs *RetryFnArgs) error, isFatalFn func(err error) bool) error

Retry runs a standard retry loop. It executes your passed in fn as the body of the loop. It returns if it exceeds the number of configured retry options or if 'isFatal' returns true.

Types

type RetryFnArgs

type RetryFnArgs struct {
	// I is the iteration of the retry "loop" and starts at 0.
	// The 0th iteration is the first call, and doesn't count as a retry.
	// The last try will equal RetryOptions.MaxRetries
	I int32
	// LastErr is the returned error from the previous loop.
	// If you have potentially expensive
	LastErr error
	// contains filtered or unexported fields
}

func (*RetryFnArgs) ResetAttempts

func (rf *RetryFnArgs) ResetAttempts()

ResetAttempts resets all Retry() attempts, starting back at iteration 0.

Source Files

retrier.go

Version
v1.3.0 (latest)
Published
Feb 8, 2025
Platform
linux/amd64
Imports
7 packages
Last checked
4 months ago

Tools for package owners.