feat(17-02): implement scheduler package with gocron wrapper and job lifecycle
- Scheduler wraps gocron with Start/Stop lifecycle - Start loads enabled jobs from DB and registers cron schedules - AddJob/RemoveJob persist to DB and sync with gocron - RunJob for manual trigger with OnComplete callback - JobResult struct for notification bridge - Promote gocron/v2 v2.19.1 to direct dependency
This commit is contained in:
@@ -1 +1,21 @@
|
||||
package scheduler
|
||||
|
||||
import "time"
|
||||
|
||||
// Job represents a scheduled scan job with its runtime function.
|
||||
type Job struct {
|
||||
Name string
|
||||
CronExpr string
|
||||
ScanCommand string
|
||||
NotifyTelegram bool
|
||||
Enabled bool
|
||||
RunFunc func(ctx interface{}) (int, error)
|
||||
}
|
||||
|
||||
// JobResult contains the outcome of a scheduled or manually triggered scan job.
|
||||
type JobResult struct {
|
||||
JobName string
|
||||
FindingCount int
|
||||
Duration time.Duration
|
||||
Error error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user