cron

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: EUPL-1.2, ISC, MIT, + 1 more Imports: 25 Imported by: 0

Documentation

Overview

Package cron schedules jobs.

Index

Constants

This section is empty.

Variables

View Source
var Tasks = []Task{
	{"vacuum pageviews (data retention)", dataRetention, 1 * time.Hour},
	{"renew ACME certs", renewACME, 2 * time.Hour},
	{"vacuum soft-deleted sites", vacuumDeleted, 12 * time.Hour},
	{"rm old exports", oldExports, 1 * time.Hour},
	{"cycle sessions", sessions, 1 * time.Minute},
	{"send email reports", emailReports, 1 * time.Hour},
	{"persist hits", persistAndStat, time.Duration(persistInterval.Load())},
}

Functions

func SetPersistInterval added in v2.4.1

func SetPersistInterval(d time.Duration)

func Start added in v2.4.1

func Start(ctx context.Context)

Start running tasks in the background.

func Stop added in v2.3.0

func Stop() error

func TaskACME added in v2.4.1

func TaskACME() error

func TaskDataRetention added in v2.4.1

func TaskDataRetention() error

func TaskEmailReports added in v2.4.1

func TaskEmailReports() error

func TaskOldExports added in v2.4.1

func TaskOldExports() error

func TaskPersistAndStat added in v2.4.1

func TaskPersistAndStat() error

func TaskSessions added in v2.4.1

func TaskSessions() error

func TaskVacuumOldSites added in v2.4.1

func TaskVacuumOldSites() error

func UpdateStats

func UpdateStats(ctx context.Context, site *goatcounter.Site, siteID int64, hits []goatcounter.Hit) error

UpdateStats updates all the stats tables.

Exported for tests.

func WaitACME added in v2.4.1

func WaitACME()

func WaitDataRetention added in v2.4.1

func WaitDataRetention()

func WaitEmailReports added in v2.4.1

func WaitEmailReports()

func WaitOldExports added in v2.4.1

func WaitOldExports()

func WaitPersistAndStat added in v2.4.1

func WaitPersistAndStat()

func WaitSessions added in v2.4.1

func WaitSessions()

func WaitVacuumOldSites added in v2.4.1

func WaitVacuumOldSites()

Types

type Task added in v2.2.0

type Task struct {
	Desc   string
	Fun    func(context.Context) error
	Period time.Duration
}

func (Task) ID added in v2.2.0

func (t Task) ID() string

Jump to

Keyboard shortcuts

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