feat: track task vs app maintenance separately

We should know _where_ the maintenance value is applied for the end-user's usage
This commit is contained in:
Jose Diaz-Gonzalez committed 2025-11-09 23:16:38 -05:00
1 parent e42df29a79
commit 3c7985cd82
1 file changed
+13 -3
+13 -3
View File
@@ -50,7 +50,13 @@ type CronTask struct {
// LogFile is the log file to write to // LogFile is the log file to write to
LogFile string `json:"-"` 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"` Maintenance bool `json:"maintenance"`
} }
@@ -127,7 +133,9 @@ func FetchCronTasks(input FetchCronTasksInput) ([]CronTask, error) {
Command: c.Command, Command: c.Command,
Schedule: c.Schedule, Schedule: c.Schedule,
ID: GenerateCommandID(appName, c), ID: GenerateCommandID(appName, c),
Maintenance: maintenance, Maintenance: isAppCronInMaintenance || maintenance,
AppInMaintenance: isAppCronInMaintenance,
TaskInMaintenance: maintenance,
}) })
} }
@@ -160,8 +168,10 @@ func FetchGlobalCronTasks() ([]CronTask, error) {
Schedule: parts[0], Schedule: parts[0],
Command: parts[1], Command: parts[1],
AltCommand: parts[1], AltCommand: parts[1],
Maintenance: false,
Global: true, Global: true,
Maintenance: false,
TaskInMaintenance: false,
AppInMaintenance: false,
} }
if len(parts) == 3 { if len(parts) == 3 {
task.LogFile = parts[2] task.LogFile = parts[2]