tasks

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HousekeeperTaskType is the name of the task responsible for cleaning
	// up stale records from the database.
	HousekeeperTaskType = "common:task:housekeeper"
)

Variables

This section is empty.

Functions

func HandleHousekeeperTask

func HandleHousekeeperTask(ctx context.Context, task *asynq.Task) error

HandleHousekeeperTask performs housekeeping activities, such as deleting stale records.

Types

type HousekeeperPayload

type HousekeeperPayload struct {
	// Retention provides the retention configuration of objects.
	Retention []RetentionConfig `yaml:"retention"`
}

HousekeeperPayload represents the payload of the housekeeper task.

type RetentionConfig

type RetentionConfig struct {
	// Name specifies the model name.
	Name string `yaml:"name" json:"name"`

	// Duration specifies the max duration for which an object will be kept,
	// if it hasn't been updated recently.
	//
	// For example:
	//
	// UpdatedAt field for an object is set to: Thu May 30 16:00:00 EEST 2024
	// Duration of the object is configured to: 4 hours
	//
	// If the object is not update anymore by the time the housekeeper runs,
	// after 20:00:00 this object will be considered as stale and removed
	// from the database.
	Duration time.Duration `yaml:"duration" json:"duration"`
}

RetentionConfig represents the retention configuration for a given model.

Jump to

Keyboard shortcuts

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