refactor cron start
This commit is contained in:
parent
0b2585de45
commit
7e7f1b212b
|
@ -6,18 +6,11 @@ module Travis::API::V3
|
||||||
end
|
end
|
||||||
|
|
||||||
def start_all()
|
def start_all()
|
||||||
started_crons = []
|
Models::Cron.all.select do |cron|
|
||||||
|
start(cron) if cron.next_enqueuing <= Time.now
|
||||||
Models::Cron.all.each do |cron|
|
|
||||||
if cron.next_enqueuing <= Time.now
|
|
||||||
started = start(cron)
|
|
||||||
started_crons.push cron if started
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
started_crons
|
|
||||||
end
|
|
||||||
|
|
||||||
def start(cron)
|
def start(cron)
|
||||||
branch = cron.branch
|
branch = cron.branch
|
||||||
raise ServerError, 'repository does not have a github_id'.freeze unless branch.repository.github_id
|
raise ServerError, 'repository does not have a github_id'.freeze unless branch.repository.github_id
|
||||||
|
|
Loading…
Reference in New Issue
Block a user