purge

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package purge implements automatic purging of inactive XMPP user accounts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Enabled activates the auto-purge service.
	Enabled bool `fig:"enabled"`

	// InactiveDays is the number of days without login after which a user is purged.
	// Defaults to 90 if not set.
	InactiveDays int `fig:"inactive_days" default:"90"`

	// RunInterval is how often the purge check runs (e.g. "24h").
	// Defaults to 24h if not set.
	RunInterval time.Duration `fig:"run_interval" default:"24h"`

	// BatchSize limits the number of users deleted per run to avoid DB spikes.
	// Defaults to 100.
	BatchSize int `fig:"batch_size" default:"100"`

	// ExcludeUsers lists usernames that must never be auto-purged (e.g. admin accounts).
	ExcludeUsers []string `fig:"exclude_users"`
}

Config holds configuration for the auto-purge service.

type Service

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

Service periodically scans for users that have been inactive for longer than the configured threshold and deletes them, firing the hook.UserDeleted hook so that all modules (MAM, roster, vCard, …) clean up their data as well.

func New

func New(cfg Config, rep repository.Repository, hosts *host.Hosts, hk *hook.Hooks, logger kitlog.Logger) *Service

New returns a new purge Service.

func (*Service) Start

func (s *Service) Start(_ context.Context) error

Start starts the purge background loop.

func (*Service) Stop

func (s *Service) Stop(_ context.Context) error

Stop signals the background loop to exit.

Jump to

Keyboard shortcuts

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