From ebfd49e61524c3314ee8a47ada8d5a77c9e0419f Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 30 Apr 2022 20:48:49 +0200 Subject: [PATCH] fix(cron): don't show error for empty cron schedule --- src/cron/daemon/daemon.v | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cron/daemon/daemon.v b/src/cron/daemon/daemon.v index 4b22522..729e94b 100644 --- a/src/cron/daemon/daemon.v +++ b/src/cron/daemon/daemon.v @@ -132,12 +132,17 @@ pub fn (mut d Daemon) run() ? { // schedule_build adds the next occurence of the given repo build to the queue. fn (mut d Daemon) schedule_build(repo_id string, repo git.GitRepo) ? { - ce := parse_expression(repo.schedule) or { - // TODO This shouldn't return an error if the expression is empty. - d.lerror("Error while parsing cron expression '$repo.schedule' ($repo_id): $err.msg()") + ce := if repo.schedule != '' { + parse_expression(repo.schedule) or { + // TODO This shouldn't return an error if the expression is empty. + d.lerror("Error while parsing cron expression '$repo.schedule' ($repo_id): $err.msg()") + d.global_schedule + } + } else { d.global_schedule } + // A repo that can't be scheduled will just be skipped for now timestamp := ce.next_from_now() ?