webhook

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package webhook implements pg-outbox delivery: signed HTTP POSTs with Keygen's outcome classification, URL checks and auto-disable rules.

Index

Constants

View Source
const MaxAttempts = 16

MaxAttempts is the reference's retry budget: the first delivery plus 15 sidekiq retries.

Variables

This section is empty.

Functions

func Backoff

func Backoff(count int, random float64) time.Duration

Backoff is the reference's sidekiq retry curve: count**4 seconds plus a jitter of 10 minutes times a uniform 1..10.

func RetryBackoff

func RetryBackoff(attempt int) time.Duration

RetryBackoff is the Keygen curve used by the relay after a failed attempt.

Types

type Store

type Store = port.WebhookDeliveryStore

Store is the worker's storage port (satisfied by *postgres.Store).

type Worker

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

Worker is the pg-outbox Publisher. Construction starts no background work.

func NewWorker

func NewWorker(
	store Store, accountID uuid.UUID, resolver domain.Resolver, allowed []*net.IPNet,
	clock func() time.Time, counters telemetry.Counters,
) *Worker

NewWorker builds the worker over the store (the account whose keys sign the deliveries).

func (*Worker) Publish

func (w *Worker) Publish(ctx context.Context, messages []outbox.Message) error

Publish delivers one independently claimed message. BatchSize must be one: pg-outbox applies a Publisher outcome to the whole batch.

Jump to

Keyboard shortcuts

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