Help us shape the future of Go! Take the 2026 Go Developer Survey

retention

package
v0.40.22 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package retention runs the daily sweeps that delete personal data once it has outlived its purpose: expired sessions (IP and User-Agent) and waitlist requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, log *slog.Logger, jobs []Job)

Run sweeps once shortly after start (a random delay under 10 minutes so replicas spread out) and then every 24 hours until ctx ends. The deletes are idempotent, so two pods sweeping is harmless.

func RunOnce

func RunOnce(ctx context.Context, log *slog.Logger, jobs []Job)

RunOnce runs every job, logging the count. A failing job is logged and does not stop the others.

Types

type Job

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

Job is one sweep: it deletes what is past retention and reports how many rows it removed.

Jump to

Keyboard shortcuts

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