tasks

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	HandleCrit func(err error)
	// contains filtered or unexported fields
}

Group is a tasks group, which can at any point be awaited to complete. Tasks in the group are run in separate go routines. If a task panics, the panic is recovered with HandleCrit.

func (*Group) Go

func (t *Group) Go(fn func() error)

func (*Group) Wait

func (t *Group) Wait() error

type Poller added in v1.11.0

type Poller struct {
	// contains filtered or unexported fields
}

Poller runs a function on repeat at a set interval. Warning: ticks can be missed, if the function execution is slow.

func NewPoller added in v1.11.0

func NewPoller(fn func(), clock clock.Clock, interval time.Duration) *Poller

func (*Poller) SetInterval added in v1.11.0

func (pd *Poller) SetInterval(interval time.Duration)

SetInterval changes the polling interval.

func (*Poller) Start added in v1.11.0

func (pd *Poller) Start()

Start starts polling in a background routine. Duplicate start calls are ignored. Only one routine runs.

func (*Poller) Stop added in v1.11.0

func (pd *Poller) Stop()

Stop stops the polling. Duplicate calls are ignored. Only if active the polling routine is stopped.

Jump to

Keyboard shortcuts

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