gitlab-org--gitlab-foss/lib/prometheus/cleanup_multiproc_dir_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
369 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module Prometheus
class CleanupMultiprocDirService
def initialize(metrics_dir)
@metrics_dir = metrics_dir
end
def execute
return if @metrics_dir.blank?
files_to_delete = Dir[File.join(@metrics_dir, '*.db')]
return if files_to_delete.blank?
FileUtils.rm_rf(files_to_delete)
end
end
end