sched

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option[T any] func(*Scheduler[T])

func WithMaxConcurrent

func WithMaxConcurrent[T any](n int) Option[T]

WithMaxConcurrent limits the number of jobs running at the same time.

type Scheduler

type Scheduler[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](execute func(ctx context.Context, item T), opts ...Option[T]) *Scheduler[T]

func (*Scheduler[T]) AddTask

func (s *Scheduler[T]) AddTask(runAt time.Time, item T)

func (*Scheduler[T]) Reset

func (s *Scheduler[T]) Reset()

Reset deletes all scheduled jobs.

func (*Scheduler[T]) Start

func (s *Scheduler[T]) Start(ctx context.Context)

func (*Scheduler[T]) Stop

func (s *Scheduler[T]) Stop()

Stop signals scheduler to stop and blocks until running jobs finish.

Jump to

Keyboard shortcuts

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