From 3c7985cd82675f5389947c4379cd83cd5858a662 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 21 Sep 2025 20:30:49 -0400 Subject: [PATCH] feat: track task vs app maintenance separately We should know _where_ the maintenance value is applied for the end-user's usage --- plugins/cron/cron.go | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/plugins/cron/cron.go b/plugins/cron/cron.go index 90cbdced7..dbca27826 100644 --- a/plugins/cron/cron.go +++ b/plugins/cron/cron.go @@ -50,7 +50,13 @@ type CronTask struct { // LogFile is the log file to write to LogFile string `json:"-"` - // Maintenance is whether the cron task is in maintenance mode + // AppInMaintenance is whether the app's cron is in maintenance mode + AppInMaintenance bool `json:"app-in-maintenance"` + + // Maintenance is whether the cron command is in maintenance mode + TaskInMaintenance bool `json:"task-in-maintenance"` + + // Maintenance is whether the cron command is in maintenance mode Maintenance bool `json:"maintenance"` } @@ -123,11 +129,13 @@ func FetchCronTasks(input FetchCronTasksInput) ([]CronTask, error) { maintenance := isAppCronInMaintenance || c.Maintenance tasks = append(tasks, CronTask{ - App: appName, - Command: c.Command, - Schedule: c.Schedule, - ID: GenerateCommandID(appName, c), - Maintenance: maintenance, + App: appName, + Command: c.Command, + Schedule: c.Schedule, + ID: GenerateCommandID(appName, c), + Maintenance: isAppCronInMaintenance || maintenance, + AppInMaintenance: isAppCronInMaintenance, + TaskInMaintenance: maintenance, }) } @@ -156,12 +164,14 @@ func FetchGlobalCronTasks() ([]CronTask, error) { id := base36.EncodeToStringLc([]byte(strings.Join(parts, ";;;"))) task := CronTask{ - ID: id, - Schedule: parts[0], - Command: parts[1], - AltCommand: parts[1], - Maintenance: false, - Global: true, + ID: id, + Schedule: parts[0], + Command: parts[1], + AltCommand: parts[1], + Global: true, + Maintenance: false, + TaskInMaintenance: false, + AppInMaintenance: false, } if len(parts) == 3 { task.LogFile = parts[2]