Improve dashboard health and state recovery

This commit is contained in:
Mikei386
2026-07-13 21:06:09 +02:00
parent 819055cbf0
commit 8f75a04db6
15 changed files with 313 additions and 38 deletions
+15
View File
@@ -14,6 +14,21 @@ type Enqueue func(model.Job) error
type EnqueueMaintenance func(string, string) (model.Run, error)
type LastRun func(string) time.Time
func PreviousScheduled(spec, timezone string, now time.Time, window time.Duration) (time.Time, error) {
expression, err := Parse(spec)
if err != nil {
return time.Time{}, err
}
loc := time.Local
if timezone != "" {
loc, err = time.LoadLocation(timezone)
if err != nil {
return time.Time{}, err
}
}
return previous(expression, now.In(loc), window).UTC(), nil
}
type Scheduler struct {
config ConfigProvider
enqueue Enqueue