dcfaf49550
After moving the multiproc dir cleanup into `config.ru`:`warmup`, we stopped cleaning Sidekiq metrics dir which is not correct. This MR intended to fix that. More details: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31668
23 lines
485 B
Ruby
23 lines
485 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Prometheus
|
|
class CleanupMultiprocDirService
|
|
include Gitlab::Utils::StrongMemoize
|
|
|
|
def execute
|
|
FileUtils.rm_rf(old_metrics) if old_metrics
|
|
end
|
|
|
|
private
|
|
|
|
def old_metrics
|
|
strong_memoize(:old_metrics) do
|
|
Dir[File.join(multiprocess_files_dir, '*.db')] if multiprocess_files_dir
|
|
end
|
|
end
|
|
|
|
def multiprocess_files_dir
|
|
::Prometheus::Client.configuration.multiprocess_files_dir
|
|
end
|
|
end
|
|
end
|