Class: GoodJob::ElasticsearchOldIndexCleanerWorker

Inherits:
HasUtils::GoodJob::BaseWorker
  • Object
show all
Includes:
HasUtils::GoodJob::UniqueJob
Defined in:
app/workers/good_job/elasticsearch_old_index_cleaner_worker.rb

Instance Method Summary collapse

Instance Method Details

#performObject



10
11
12
13
14
15
16
17
18
19
20
# File 'app/workers/good_job/elasticsearch_old_index_cleaner_worker.rb', line 10

def perform
  # Record the starting time of the process
  starting_time = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)

  # Iterate over each index class and attempt to clean old indices
  ::HasHelpers::Index.indices&.each do |index_class|
    clean_old_indices(index_class, starting_time)
  rescue StandardError => e
    handle_error(index_class.name, starting_time, e)
  end
end