Skip to content

Commit

Permalink
batches task using find_each instead of all
Browse files Browse the repository at this point in the history
  • Loading branch information
xuanxu committed Sep 27, 2015
1 parent 43d7745 commit a5874e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tasks/users.rake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace :users do

desc "Recalculates all the failed census calls counters for users"
task count_failed_census_calls: :environment do
User.all.pluck(:id).each{ |id| User.reset_counters(id, :failed_census_calls) }
User.find_each{ |user| User.reset_counters(user.id, :failed_census_calls)}
end

end

0 comments on commit a5874e7

Please sign in to comment.