dispatch

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const Recheck = 30 * time.Second

Recheck bounds the wait for the next due time. A timer counts monotonic time, which stops while the system sleeps and ignores a wall-clock change, so the runner reads the wall clock again at least this often: an occurrence that became due during sleep runs within Recheck of the wake.

Variables

This section is empty.

Functions

func First

func First(timing protocol.DispatchTiming, timestamp int64) (int64, error)

func Occurrence

func Occurrence(schedule protocol.DispatchSchedule, timestamp int64) (int64, *int64, error)

func TurnResult

func TurnResult(run protocol.ConversationRun) (bool, error)

Types

type Batch

type Batch struct {
	Work    []Work
	Pending bool
	NextMs  *int64
}

type Calendar

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

func NewCalendar

func NewCalendar(timezone string, weekdays []uint8, hour, minute uint8) (*Calendar, error)

func (*Calendar) Due

func (calendar *Calendar) Due(first, timestamp int64) (int64, *int64, error)

func (*Calendar) Next

func (calendar *Calendar) Next(timestamp int64) (*int64, error)

type Runner

type Runner struct {
	Clock    clockwork.Clock
	Wake     <-chan struct{}
	Tick     func(context.Context, bool) (Batch, error)
	Execute  func(context.Context, Work) error
	Finished func(context.Context, protocol.JobID, error) error
	Report   func(error)
}

func (Runner) Serve

func (runner Runner) Serve(ctx context.Context)

type Work

type Work struct {
	User        protocol.User
	StorageUser protocol.UserID
	Job         protocol.JobID
	Request     protocol.Request
	Completion  protocol.DispatchCompletion
}

Jump to

Keyboard shortcuts

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