debian-mirror-gitlab/lib/prometheus/cleanup_multiproc_dir_service.rb
2022-06-21 17:19:12 +05:30

18 lines
369 B
Ruby

# 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