tasks

package
v1.16.13 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Await

func Await[E any](ctx context.Context, src chan E, dest *E) error

Await waits for a value, and sets it to the destination value. This returns an error if the context closes before a value is received from the channel.

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

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

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

func (*Poller) SetInterval

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

SetInterval changes the polling interval.

func (*Poller) Start

func (pd *Poller) Start()

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

func (*Poller) Stop

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