refactor(cron): improve delivery configuration handling in CronJobEditor and CLI

- Enhanced the delivery configuration logic in CronJobEditor to explicitly set the bestEffort property based on job settings.
- Refactored the CLI command to streamline delivery object creation, ensuring proper handling of optional fields like channel and to.
- Improved code readability and maintainability by restructuring delivery assignment logic.

This update clarifies the delivery configuration process, enhancing the reliability of job settings in both the editor and CLI.
This commit is contained in:
Tyler Yust
2026-02-03 19:09:27 -08:00
committed by Peter Steinberger
parent 64df61f697
commit 246896d64b
2 changed files with 18 additions and 11 deletions

View File

@@ -107,7 +107,11 @@ extension CronJobEditor {
delivery["channel"] = trimmed.isEmpty ? "last" : trimmed
let to = self.to.trimmingCharacters(in: .whitespacesAndNewlines)
if !to.isEmpty { delivery["to"] = to }
if self.bestEffortDeliver { delivery["bestEffort"] = true }
if self.bestEffortDeliver {
delivery["bestEffort"] = true
} else if self.job?.delivery?.bestEffort == true {
delivery["bestEffort"] = false
}
}
return delivery
}