delayedwork

package
Version: v0.0.0-...-422233c Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DelayedWorkFunc

type DelayedWorkFunc func(context.Context)

type DelayedWorkManager

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

func NewDelayedWorkManager

func NewDelayedWorkManager() *DelayedWorkManager

func (*DelayedWorkManager) Start

func (dwm *DelayedWorkManager) Start(ctx context.Context)

func (*DelayedWorkManager) Submit

func (dwm *DelayedWorkManager) Submit(ctx context.Context, req DelayedWorkRequest)

type DelayedWorkRequest

type DelayedWorkRequest struct {
	ID        string
	SoftDelay time.Duration
	HardDelay time.Duration
	Func      DelayedWorkFunc
}

DelayedWorkRequest serves as an argument to DelayedWorkManager.Submit

ID should be unique among works managed here

Every submit of the same work as identified by ID will be delayed for at most SoftDelay time

Func will be called after either SoftDelay since each submit, or HardDelay since first submit, whichever comes first

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL