PERF: move avg time calculation to daily
This commit is contained in:
parent
6e9f5f5584
commit
95d13bf68a
|
@ -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
|
|
@ -8,9 +8,6 @@ module Jobs
|
|||
every 15.minutes
|
||||
|
||||
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
|
||||
CategoryFeaturedTopic.feature_topics
|
||||
|
|
Loading…
Reference in New Issue