From 7e7f1b212b896539cd34a315fe3eb18414d1efda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Ko=CC=88tte?= Date: Thu, 14 Apr 2016 12:53:23 +0200 Subject: [PATCH] refactor cron start --- lib/travis/api/v3/queries/crons.rb | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/travis/api/v3/queries/crons.rb b/lib/travis/api/v3/queries/crons.rb index e702ca1f..aec65134 100644 --- a/lib/travis/api/v3/queries/crons.rb +++ b/lib/travis/api/v3/queries/crons.rb @@ -6,16 +6,9 @@ module Travis::API::V3 end def start_all() - started_crons = [] - - Models::Cron.all.each do |cron| - if cron.next_enqueuing <= Time.now - started = start(cron) - started_crons.push cron if started - end + Models::Cron.all.select do |cron| + start(cron) if cron.next_enqueuing <= Time.now end - - started_crons end def start(cron)