mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 06:43:40 +08:00
30990006a9
This reduces chances of errors where consumers of strings mutate inputs and reduces memory usage of the app. Test suite passes now, but there may be some stuff left, so we will run a few sites on a branch prior to merging
34 lines
801 B
Ruby
34 lines
801 B
Ruby
# frozen_string_literal: true
|
|
|
|
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)
|
|
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
|
|
MiniScheduler::Manager.discover_schedules.each do |schedule|
|
|
puts "Running #{schedule}"
|
|
time { schedule.new.execute({}) }
|
|
end
|
|
end
|