PERF: Only delete 100 inactive users at once

This commit is contained in:
Robin Ward 2014-08-13 17:56:21 -04:00
parent 5caf72510c
commit ba15a6a9ea
1 changed files with 1 additions and 0 deletions

View File

@ -728,6 +728,7 @@ class User < ActiveRecord::Base
.joins('INNER JOIN user_stats AS us ON us.user_id = users.id')
.where("created_at < ?", SiteSetting.purge_inactive_users_grace_period_days.days.ago)
.where('us.post_count = 0')
.limit(100)
destroyer = UserDestroyer.new(Discourse.system_user)
to_destroy.each do |u|