retry

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package retry provides automatic retry handling for failed webhook deliveries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	CheckInterval time.Duration // How often to check for retryable deliveries
	BatchSize     int           // Max number of deliveries to retry per check
	MaxRetries    int           // Maximum retry attempts
}

Config holds configuration for the retry handler.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a default retry handler configuration.

type Logger

type Logger interface {
	Info(msg string, args ...any)
	Error(msg string, args ...any)
	Debug(msg string, args ...any)
	Warn(msg string, args ...any)
}

Logger defines the logging interface for the retry handler.

type Option

type Option func(*RetryHandler)

Option configures the RetryHandler.

func WithConfig

func WithConfig(cfg Config) Option

WithConfig sets the configuration for the handler.

func WithLogger

func WithLogger(logger Logger) Option

WithLogger sets the logger for the handler.

type RetryHandler

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

RetryHandler periodically checks for and retries failed webhook deliveries.

func NewRetryHandler

func NewRetryHandler(
	repo repository.WebhookRepository,
	svc *service.WebhookService,
	opts ...Option,
) *RetryHandler

NewRetryHandler creates a new retry handler.

func (*RetryHandler) IsRunning

func (h *RetryHandler) IsRunning() bool

IsRunning returns whether the retry handler is currently running.

func (*RetryHandler) Start

func (h *RetryHandler) Start(ctx context.Context)

Start begins the periodic retry processing.

func (*RetryHandler) Stop

func (h *RetryHandler) Stop()

Stop gracefully shuts down the retry handler.

func (*RetryHandler) TriggerNow

func (h *RetryHandler) TriggerNow()

TriggerNow forces an immediate retry check outside the normal schedule.

Jump to

Keyboard shortcuts

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