tasks

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 6 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Task

type Task struct {
	Log *logrus.Entry
	// contains filtered or unexported fields
}

func (*Task) Stop

func (t *Task) Stop()

type TaskFunc added in v0.20.0

type TaskFunc func(ctx context.Context)

type TaskManager

type TaskManager struct {
	Log *logrus.Entry
	Tr  *i18n.TranslationSet
	// contains filtered or unexported fields
}

func NewTaskManager

func NewTaskManager(log *logrus.Entry, translationSet *i18n.TranslationSet) *TaskManager

func (*TaskManager) Close added in v0.7.2

func (t *TaskManager) Close()

Close closes the task manager, killing whatever task may currently be running

func (*TaskManager) NewTask

func (t *TaskManager) NewTask(f func(ctx context.Context)) error

func (*TaskManager) NewTickerTask

func (t *TaskManager) NewTickerTask(duration time.Duration, before func(ctx context.Context), f func(ctx context.Context, notifyStopped chan struct{})) error

NewTickerTask is a convenience function for making a new task that repeats some action once per e.g. second the before function gets called after the lock is obtained, but before the ticker starts. if you handle a message on the stop channel in f() you need to send a message on the notifyStopped channel because returning is not sufficient. Here, unlike in a regular task, simply returning means we're now going to wait till the next tick to run again.

Jump to

Keyboard shortcuts

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