From 73a3c2270f67b47281b79b6dccca48df473bde84 Mon Sep 17 00:00:00 2001 From: Wedge Date: Sat, 4 Jun 2016 17:24:57 +0300 Subject: [PATCH] Trying to fix sidekiq memory leak --- app/jobs/remove_outdated_items_job.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/jobs/remove_outdated_items_job.rb b/app/jobs/remove_outdated_items_job.rb index 5c470de35..a799ceaa5 100644 --- a/app/jobs/remove_outdated_items_job.rb +++ b/app/jobs/remove_outdated_items_job.rb @@ -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}"