Documentation
¶
Index ¶
- func IsOneShot(schedule string) bool
- type Job
- type Scheduler
- func (s *Scheduler) Count() (int, error)
- func (s *Scheduler) Create(name, schedule, skillName, command, params string) (int64, error)
- func (s *Scheduler) Delete(id int64) error
- func (s *Scheduler) Get(id int64) (*Job, error)
- func (s *Scheduler) List(enabledOnly bool) ([]Job, error)
- func (s *Scheduler) OnTrigger(fn func(Job))
- func (s *Scheduler) Pause(id int64) error
- func (s *Scheduler) RecordFailure(id int64) error
- func (s *Scheduler) RecordSuccess(id int64) error
- func (s *Scheduler) Resume(id int64) error
- func (s *Scheduler) RunningCount() int
- func (s *Scheduler) SetMaxConcurrent(n int)
- func (s *Scheduler) Start(ctx context.Context)
- func (s *Scheduler) StopAll()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Job ¶
type Job struct {
ID int64
Name string
Schedule string // cron expression or "every Xm/Xh/Xd"
SkillName string // skill to run, or empty for shell command
Command string // shell command if no skill
Params string // JSON params for skill
Enabled bool
LastRun *time.Time
NextRun time.Time
FailCount int
CreatedAt time.Time
}
Job represents a scheduled task.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler manages cron-like scheduled jobs.
func (*Scheduler) RecordFailure ¶
RecordFailure increments failure count and auto-pauses if threshold exceeded.
func (*Scheduler) RecordSuccess ¶
RecordSuccess updates a job after successful execution.
func (*Scheduler) RunningCount ¶
RunningCount returns the number of currently running jobs.
func (*Scheduler) SetMaxConcurrent ¶
SetMaxConcurrent sets the max number of concurrent cron jobs.
Click to show internal directories.
Click to hide internal directories.