optimise regular job to avoid touching posts that have not changed

This commit is contained in:
Sam Saffron 2013-09-19 18:34:42 -07:00
parent 1815a5a306
commit 085493e35d

View file

@ -284,7 +284,8 @@ class Post < ActiveRecord::Base
AND p2.user_id <> post_timings.user_id
GROUP BY post_timings.topic_id, post_timings.post_number) AS x
WHERE x.topic_id = posts.topic_id
AND x.post_number = posts.post_number")
AND x.post_number = posts.post_number
AND (posts.avg_time <> (x.gmean / 1000)::int OR posts.avg_time IS NULL)")
end
end