discourse/lib/tasks/scheduler.rake

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
796 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2019-08-01 04:12:05 -04:00
require "benchmark"
2013-03-10 08:51:49 -04: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
task periodical_updates: :environment do
Jobs::PeriodicalUpdates.new.execute(nil)
2013-03-10 08:51:49 -04:00
end
task version_check: :environment do
Jobs::VersionCheck.new.execute(nil)
end
desc "run every task the scheduler knows about in that order, use only for debugging"
task "scheduler:run_all" => :environment do
MiniScheduler::Manager.discover_schedules.each do |schedule|
puts "Running #{schedule}"
2019-08-01 04:12:05 -04:00
elapsed = Benchmark.realtime { schedule.new.execute({}) }
puts "Elapsed #{(elapsed * 1000).to_i}ms"
end
end