PERF: move avg time calculation to daily

This commit is contained in:
Sam 2014-07-25 13:21:10 +10:00
parent 6e9f5f5584
commit 95d13bf68a
2 changed files with 15 additions and 3 deletions

View File

@ -0,0 +1,15 @@
module Jobs
class CalculateAvgTime < Jobs::Scheduled
every 1.day
# PERF: these calculations can become exceedingly expnsive
# they run a huge gemoetric mean and are hard to optimise
# defer to only run once a day
def execute(args)
# Update the average times
Post.calculate_avg_time(2.days.ago)
Topic.calculate_avg_time(2.days.ago)
end
end
end

View File

@ -8,9 +8,6 @@ module Jobs
every 15.minutes every 15.minutes
def execute(args) def execute(args)
# Update the average times
Post.calculate_avg_time(1.day.ago)
Topic.calculate_avg_time(1.day.ago)
# Feature topics in categories # Feature topics in categories
CategoryFeaturedTopic.feature_topics CategoryFeaturedTopic.feature_topics