Version: v0.9.1 Latest Latest

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

Go to latest
Published: Mar 19, 2020 License: MIT Imports: 5 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Task

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

func (*Task) Stop

func (t *Task) Stop()

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(stop chan struct{})) error

func (*TaskManager) NewTickerTask

func (t *TaskManager) NewTickerTask(duration time.Duration, before func(stop chan struct{}), f func(stop, 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.

Source Files

Jump to

Keyboard shortcuts

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