async_task

package
v0.0.0-...-21d585c Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncTask

type AsyncTask struct {
	*async.TaskGroup
	// contains filtered or unexported fields
}

AsyncTask is an asynchronous task runner for functions of type Task.

func NewAsyncTask

func NewAsyncTask(f Task, replicas int) *AsyncTask

NewAsyncTask creates a new instance of AsyncTask.

func (*AsyncTask) Run

func (at *AsyncTask) Run(ctx context.Context)

Run executes a number of asynchronous tasks in loop and blocks until a shutdown signal is triggered, or the parent context is canceled. The number of executed tasks is defined by the replicas parameter.

type Task

type Task func() error

Task represents a task that needs to be always running.

Jump to

Keyboard shortcuts

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