PERF: Fetch users in batches in grant anniversary badge job.

This commit is contained in:
Guo Xiang Tan 2017-06-23 16:53:07 +09:00
parent c1c778f1e5
commit 6cc174ca82
1 changed files with 2 additions and 3 deletions

View File

@ -32,13 +32,12 @@ module Jobs
SQL
badge = Badge.find(Badge::Anniversary)
user_ids = results.map {|r| r['user_id'].to_i }
user_ids = results.map { |r| r['user_id'].to_i }
User.where(id: user_ids).each do |user|
User.where(id: user_ids).find_each do |user|
BadgeGranter.grant(badge, user, created_at: end_date)
end
end
end
end