periodictask

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	TaskInterval    time.Duration
	TaskTimeout     time.Duration
	RunnerFrequency time.Duration
}

func CreateDefaultConfig

func CreateDefaultConfig() Config

type Coordinator

type Coordinator interface {
	locker.Locker

	LastRunTimestamp(
		ctx context.Context,
		key string,
	) (*time.Time, error)

	UpdateLastRunTimestamp(
		ctx context.Context,
		key string,
	) error
}

type PeriodicSingleTaskRunner

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

func NewSingleTaskRunner

func NewSingleTaskRunner(
	ctx context.Context,
	taskKey string,
	taskFunc func(context.Context) error,
	coordinator Coordinator,
	config *Config,
) *PeriodicSingleTaskRunner

func (*PeriodicSingleTaskRunner) Done

func (r *PeriodicSingleTaskRunner) Done() <-chan struct{}

Done copied from context.Context

Jump to

Keyboard shortcuts

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