From 5e734516db2b1a5b92e227951f18d00457da6b84 Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Mon, 25 Nov 2024 22:21:14 +0200 Subject: [PATCH] DEV: Drop DISCOURSE_LIVE_SLOTS_SIDEKIQ_LIMIT (#29920) This was used to track jobs that may leak memory, but proved to be too noisy and not very useful. --- app/jobs/base.rb | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/app/jobs/base.rb b/app/jobs/base.rb index e1042afb80a..bf5ad4f64bc 100644 --- a/app/jobs/base.rb +++ b/app/jobs/base.rb @@ -88,6 +88,7 @@ module Jobs @data["net_duration"] = profile.dig(:net, :duration) || 0 # Redis Duration (s) @data["net_calls"] = profile.dig(:net, :calls) || 0 # Redis commands @data["live_slots_finish"] = GC.stat[:heap_live_slots] + @data["live_slots"] = @data["live_slots_finish"] - @data["live_slots_start"] if exception.present? @data["exception"] = exception # Exception - if job fails a json encoded exception @@ -136,27 +137,12 @@ module Jobs @data["@timestamp"] = Time.now @data["duration"] = current_duration if @data["status"] == "pending" self.class.raw_log("#{@data.to_json}\n") - - if live_slots_limit > 0 && @data["live_slots_start"].present? && - @data["live_slots_finish"].present? - live_slots = @data["live_slots_finish"] - @data["live_slots_start"] - - if live_slots >= live_slots_limit - Rails.logger.warn( - "Sidekiq Job '#{@data["job_name"]}' allocated #{live_slots} objects in the heap: #{@data.inspect}", - ) - end - end end def enabled? Discourse.enable_sidekiq_logging? end - def live_slots_limit - @live_slots_limit ||= ENV["DISCOURSE_LIVE_SLOTS_SIDEKIQ_LIMIT"].to_i - end - def self.mutex @@mutex ||= Mutex.new end