deliver

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package deliver is the outbound worker: it claims due deliveries from the store and POSTs the original event body to the configured targets with exponential backoff, jitter and a dead-letter terminal state.

Delivery is at-least-once. Consumers should dedupe on the X-Hookkeep-Event-Id header if they cannot tolerate duplicates.

Index

Constants

View Source
const Visibility = 2 * time.Minute

Visibility is the in-flight lease: a delivery claimed longer than this is considered abandoned (worker crashed) and becomes claimable again. It must comfortably exceed the longest target timeout.

Variables

This section is empty.

Functions

This section is empty.

Types

type Worker

type Worker struct {
	Store  *store.Store
	Cfg    *config.Config
	Log    *slog.Logger
	Client *http.Client // shared; per-request timeout comes from target config
	Jitter func() float64
	// contains filtered or unexported fields
}

func New

func New(st *store.Store, cfg *config.Config, log *slog.Logger) *Worker

New wires a worker from config. The http.Client has no global timeout; each request carries a context deadline from its target's timeout.

func (*Worker) Run

func (w *Worker) Run(ctx context.Context)

Run polls for due deliveries until ctx is canceled, then waits for in-flight requests to finish. Deliveries interrupted by a hard crash are reclaimed by the visibility timeout.

Jump to

Keyboard shortcuts

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