tasks

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: Apache-2.0 Imports: 8 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"
	// DeleteArchivedTaskType is the name of the task responsible for deleting
	// archived tasks from a task queue
	DeleteArchivedTaskType = "common:task:delete-archived-tasks"
	// DeleteCompletedTaskType is the name of the task responsible for deleting
	// completed tasks from a task queue
	DeleteCompletedTaskType = "common:task:delete-completed-tasks"
)

Variables

This section is empty.

Functions

func HandleDeleteArchivedTask added in v0.1.8

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

HandleDeleteArchivedTask deletes archived tasks.

func HandleDeleteCompletedTask added in v0.1.8

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

HandleDeleteCompletedTask deletes completed tasks.

func HandleHousekeeperTask

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

HandleHousekeeperTask performs housekeeping activities, such as deleting stale records.

Types

type DeleteQueuePayload added in v0.1.8

type DeleteQueuePayload struct {
	// Name of the queue that holds the tasks.
	Queue string `yaml:"queue" json:"queue"`
}

DeleteQueuePayload represents the payload of a task management task.

type HousekeeperPayload

type HousekeeperPayload struct {
	// Retention provides the retention configuration of objects.
	Retention []RetentionConfig `yaml:"retention" json:"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