Load user records in batches.

This commit is contained in:
Guo Xiang Tan 2017-05-05 10:57:31 +08:00
parent 1b526ebd91
commit 50c8ae2c10

View File

@ -33,7 +33,7 @@ module Jobs
WHERE cu.category_id = ? AND cu.user_id = users.id AND cu.notification_level = ?
)', post.topic.category_id, CategoryUser.notification_levels[:muted])
users.each do |user|
users.find_each do |user|
if Guardian.new(user).can_see?(post)
if EmailLog.reached_max_emails?(user)
skip(user.email, user.id, post.id, I18n.t('email_log.exceeded_emails_limit'))