PERF: release results in a couple of cases
This commit is contained in:
parent
139d0813b4
commit
12fd0b827e
|
@ -33,7 +33,8 @@ module Jobs
|
|||
HAVING COUNT(p.id) > 0 AND COUNT(ub.id) = 0
|
||||
SQL
|
||||
|
||||
user_ids = results.map { |r| r['user_id'].to_i }
|
||||
user_ids = results.column_values(0)
|
||||
results.clear
|
||||
|
||||
User.where(id: user_ids).find_each do |user|
|
||||
BadgeGranter.grant(badge, user, created_at: end_date)
|
||||
|
|
|
@ -82,7 +82,10 @@ module Jobs
|
|||
LIMIT #{MAX_AWARDED}
|
||||
SQL
|
||||
|
||||
User.exec_sql(sql).map { |r| [r['id'].to_i, r['score'].to_f] }.to_h
|
||||
result = User.exec_sql(sql)
|
||||
rval = result.map { |r| [r['id'].to_i, r['score'].to_f] }.to_h
|
||||
result.clear
|
||||
rval
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue