Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cleanup_multiproc_dir_service.rb « prometheus « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6418b4de166b0c8a86df67740b95f6e5c2db57e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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