maintenance

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package maintenance runs periodic background cleanup tasks, such as deleting expired idempotency keys and published outbox messages, so tables that grow over time stay bounded.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reaper

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

Reaper runs its tasks on a fixed interval until the context is cancelled.

func NewReaper

func NewReaper(logger *slog.Logger, interval time.Duration, tasks ...Task) *Reaper

func (*Reaper) Run

func (r *Reaper) Run(ctx context.Context) error

Run blocks until ctx is cancelled, running every task each interval.

type Task

type Task struct {
	Name string
	Run  func(context.Context) (int64, error)
}

Task is a named cleanup function returning how many rows it removed.

Jump to

Keyboard shortcuts

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