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:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user