Skip to content

Commit

Permalink
Fail early if no scheduled jobs exist (#57)
Browse files Browse the repository at this point in the history
* Add precondition

* Update to error message
  • Loading branch information
jdmcd authored Jan 24, 2020
1 parent 64f9946 commit d913166
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/Jobs/JobsCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ public final class JobsCommand: Command {

/// Starts the scheduled jobs in-process
public func startScheduledJobs() throws {
guard !self.application.jobs.configuration.scheduledJobs.isEmpty else {
self.application.logger.warning("No scheduled jobs exist, exiting scheduled jobs worker.")
return
}

self.application.jobs.configuration.scheduledJobs
.forEach { self.schedule($0) }
}
Expand Down

0 comments on commit d913166

Please sign in to comment.