Help us shape the future of Go! Take the 2026 Go Developer Survey

tasks

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 6 Imported by: 0

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

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

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