2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-08-01 03:12:05 -05:00
|
|
|
require 'benchmark'
|
|
|
|
|
2013-03-10 07:51:49 -05:00
|
|
|
desc "This task is called by the Heroku scheduler add-on"
|
|
|
|
|
|
|
|
task enqueue_digest_emails: :environment do
|
|
|
|
Jobs::EnqueueDigestEmails.new.execute(nil)
|
|
|
|
end
|
|
|
|
|
|
|
|
task category_stats: :environment do
|
|
|
|
Jobs::CategoryStats.new.execute(nil)
|
|
|
|
end
|
|
|
|
|
2013-03-28 12:02:59 -05:00
|
|
|
task periodical_updates: :environment do
|
|
|
|
Jobs::PeriodicalUpdates.new.execute(nil)
|
2013-03-10 07:51:49 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
task version_check: :environment do
|
|
|
|
Jobs::VersionCheck.new.execute(nil)
|
|
|
|
end
|
2017-08-25 11:19:27 -05:00
|
|
|
|
|
|
|
desc "run every task the scheduler knows about in that order, use only for debugging"
|
|
|
|
task 'scheduler:run_all' => :environment do
|
2018-07-31 16:12:55 -05:00
|
|
|
MiniScheduler::Manager.discover_schedules.each do |schedule|
|
2017-08-25 11:19:27 -05:00
|
|
|
puts "Running #{schedule}"
|
2019-08-01 03:12:05 -05:00
|
|
|
elapsed = Benchmark.realtime { schedule.new.execute({}) }
|
|
|
|
puts "Elapsed #{(elapsed * 1000).to_i}ms"
|
2017-08-25 11:19:27 -05:00
|
|
|
end
|
|
|
|
end
|