Trying to fix sidekiq memory leak

This commit is contained in:
Wedge 2016-06-04 17:24:57 +03:00
parent 54e4622ce1
commit 73a3c2270f
1 changed files with 3 additions and 1 deletions

View File

@ -15,7 +15,9 @@ class RemoveOutdatedItemsJob < BaseActiveRecordJob
counter_pbl = ProductBuildList.outdated.count
ProductBuildList.outdated.destroy_all
User.find_each(batch_size: 50) do |u|
u.activity_feeds.outdated.destroy_all
u.activity_feeds.outdated.find_each(batch_size: 100) do |a|
a.destroy
end
end
File.open(log_file, "w") do |f|
f.puts "Build Lists deleted: #{counter_bl}"