retrymiddleware

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RetryConstantBackoff

type RetryConstantBackoff struct {
	RetryMiddlewareOptions
	// contains filtered or unexported fields
}

RetryConstantBackoff is a Middleware that will retry jobs after failures. By Default, it runs after Panics, Deferred Jobs (by other Middleware) or if OverLapped Jobs are prohibited. It uses a Constant Backoff Scheme and is implemented by github.com/cenkalti/backoff/v4

func NewDefaultRetryConstantBackoff

func NewDefaultRetryConstantBackoff() *RetryConstantBackoff

NewDefaultRetryConstantBackoff Create a Constant Backoff Handler with 1 second

func NewRetryConstantBackoff

func NewRetryConstantBackoff(interval time.Duration) *RetryConstantBackoff

NewConstandBackoffMW Create a Constant Backoff Handler with Specified Duration

func (*RetryConstantBackoff) Handler

func (ebh *RetryConstantBackoff) Handler(s *taskmanager.Task, prerun bool, e error) (retry taskmanager.RetryResult, err error)

Handler Run the Contant Backoff Handler

func (*RetryConstantBackoff) Initilize

func (ebh *RetryConstantBackoff) Initilize(s *taskmanager.Task)

func (*RetryConstantBackoff) Reset

func (ebh *RetryConstantBackoff) Reset(s *taskmanager.Task) (ok bool)

type RetryCountLimit

type RetryCountLimit struct {
	RetryMiddlewareOptions
	// contains filtered or unexported fields
}

RetryConstantBackoff is a Middleware that will retry jobs after failures. By Default, it runs after Panics, Deferred Jobs (by other Middleware) or if OverLapped Jobs are prohibited. It uses a Constant Backoff Scheme and is implemented by github.com/cenkalti/backoff/v4

func NewDefaultRetryCountLimit

func NewDefaultRetryCountLimit() *RetryCountLimit

NewDefaultRetryConstantBackoff Create a Constant Backoff Handler with 1 second

func NewRetryRetryCountLimit

func NewRetryRetryCountLimit(limit int) *RetryCountLimit

NewConstandBackoffMW Create a Constant Backoff Handler with Specified Duration

func (*RetryCountLimit) Handler

func (ebh *RetryCountLimit) Handler(s *taskmanager.Task, prerun bool, e error) (retry taskmanager.RetryResult, err error)

Handler Run the Contant Backoff Handler

func (*RetryCountLimit) Initilize

func (ebh *RetryCountLimit) Initilize(s *taskmanager.Task)

func (*RetryCountLimit) Reset

func (ebh *RetryCountLimit) Reset(s *taskmanager.Task) (ok bool)

type RetryExponentialBackoff

type RetryExponentialBackoff struct {
	RetryMiddlewareOptions
	// contains filtered or unexported fields
}

RetryExponentialBackoff will retry a job using a exponential backoff By Default, it runs after Panics, Deferred Jobs (by other Middleware) or if OverLapped Jobs are prohibited. It uses a Exponential Backoff Scheme and is implemented by github.com/cenkalti/backoff/v4

func NewDefaultRetryExponentialBackoff

func NewDefaultRetryExponentialBackoff() *RetryExponentialBackoff

NewDefaultExponentialBackoffMW Create a ExponentialBackoff Handler with Default settings

func NewRetryExponentialBackoff

func NewRetryExponentialBackoff(ebo *backoff.ExponentialBackOff) *RetryExponentialBackoff

NewExponentialBackoffMW Create a ExponentialBackoff Handler Custom Settings Uses github.com/cenkalti/backoff/v4 as the Backoff Implementation

func (*RetryExponentialBackoff) Handler

func (ebh *RetryExponentialBackoff) Handler(s *taskmanager.Task, prerun bool, e error) (retry taskmanager.RetryResult, err error)

Handler Run the ExponentialBackoff

func (*RetryExponentialBackoff) Initilize

func (ebh *RetryExponentialBackoff) Initilize(s *taskmanager.Task)

func (*RetryExponentialBackoff) Reset

func (ebh *RetryExponentialBackoff) Reset(s *taskmanager.Task) (ok bool)

type RetryMiddlewareOptions

type RetryMiddlewareOptions struct {
	// contains filtered or unexported fields
}

func (*RetryMiddlewareOptions) HandleDeferred

func (retryOptions *RetryMiddlewareOptions) HandleDeferred(val bool)

HandleDeferred Enable/Disable the ExponetialBackoff Handler for Deferred Jobs

func (*RetryMiddlewareOptions) HandleOverlap

func (retryOptions *RetryMiddlewareOptions) HandleOverlap(val bool)

HandleOverlap Enable/Disable the ExponetialBackoff Handler for Overlapped Jobs

func (*RetryMiddlewareOptions) HandlePanic

func (retryOptions *RetryMiddlewareOptions) HandlePanic(val bool)

HandlePanic Enable/Disable the ExponetialBackoff Handler for Panics

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL