From 6e1809ce32f85150556bc7213c010323cdda6ec5 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 25 Aug 2017 12:19:27 -0400 Subject: [PATCH] add a debugging task for running all schedules --- lib/tasks/scheduler.rake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/tasks/scheduler.rake b/lib/tasks/scheduler.rake index d7d1efeb86b..14e40188281 100644 --- a/lib/tasks/scheduler.rake +++ b/lib/tasks/scheduler.rake @@ -19,3 +19,17 @@ end task version_check: :environment do Jobs::VersionCheck.new.execute(nil) end + +def time + start = Time.now + yield + puts "Elapsed #{((Time.now - start) * 1000).to_i}ms" +end + +desc "run every task the scheduler knows about in that order, use only for debugging" +task 'scheduler:run_all' => :environment do + Scheduler::Manager.discover_schedules.each do |schedule| + puts "Running #{schedule}" + time { schedule.new.execute({}) } + end +end