schedule

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scheduler

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

func New

func New(ctx context.Context, conf *config.Config, logger *zap.Logger) (*Scheduler, error)

New creates a new scheduler instance. TODO: convert all the go-routines into effectiet using Select & For channel

func (*Scheduler) DiscardTaskNow

func (s *Scheduler) DiscardTaskNow(taskID string)

DiscardTaskNow removes a task from the scheduler and won't stops the task if it is running.

if the task is not found in scheduler, it logs a message.

func (*Scheduler) ScheduleTask

func (s *Scheduler) ScheduleTask(t *models.Task)

ScheduleTask schedules the task based on the start time.

func (*Scheduler) ScheduleTaskNow

func (s *Scheduler) ScheduleTaskNow(t *models.Task) error

It returns an error if the task is already scheduled.

func (*Scheduler) Start

func (s *Scheduler) Start(ctx context.Context) error

Start starts the scheduler. It schedules all the active tasks that read from the database.

Jump to

Keyboard shortcuts

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