Documentation
¶
Index ¶
- type ScheduledTask
- type Scheduler
- func (s *Scheduler) GetTaskStore() store.TaskStore
- func (s *Scheduler) List(ctx context.Context) []*ScheduledTask
- func (s *Scheduler) Schedule(task worker.Task, interval time.Duration, maxRuns int) error
- func (s *Scheduler) ScheduleCron(task worker.Task, cronExpr string, maxRuns int) error
- func (s *Scheduler) ScheduleInterval(ctx context.Context, task worker.Task, interval time.Duration) error
- func (s *Scheduler) Start()
- func (s *Scheduler) Stop()
- func (s *Scheduler) Unschedule(ctx context.Context, taskID string) error
- type SchedulerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ScheduledTask ¶
type ScheduledTask struct {
Task worker.Task
Interval time.Duration
NextRun time.Time
LastRun time.Time
IsActive bool
CronSchedule string
CronEntryID cron.EntryID
MaxRuns int // Maximum number of times the task should run
CurrentRuns int // Current number of times the task has run
}
ScheduledTask represents a task with scheduling information
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler manages scheduled tasks
func NewScheduler ¶
func NewScheduler(config SchedulerConfig) (*Scheduler, error)
NewScheduler creates a new scheduler with the given configuration
func (*Scheduler) GetTaskStore ¶
GetTaskStore returns the task store for external access
func (*Scheduler) List ¶
func (s *Scheduler) List(ctx context.Context) []*ScheduledTask
List returns all scheduled tasks
func (*Scheduler) ScheduleCron ¶
ScheduleCron schedules a task to run based on a cron expression
type SchedulerConfig ¶
type SchedulerConfig struct {
// Worker pool configuration
WorkerPoolConfig pool.WorkerPoolConfig
// Default schedule interval
DefaultInterval time.Duration
// Maximum number of scheduled tasks
MaxTasks int
// Task store for persistence
TaskStore store.TaskStore
// Enable persistence for scheduled tasks
EnablePersistence bool
}
SchedulerConfig defines the configuration for a scheduler
Click to show internal directories.
Click to hide internal directories.