Class: Lato::LatoOperationsCleanerJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/lato/lato_operations_cleaner_job.rb

Instance Method Summary collapse

Instance Method Details

#performObject



3
4
5
6
7
8
# File 'app/jobs/lato/lato_operations_cleaner_job.rb', line 3

def perform
  # delete all operations that are not running and are older than 12 hours
  Lato::Operation.where.not(status: :running).where('lato_operations.created_at < ?', 12.hours.ago).find_in_batches do |operations|
    operations.each(&:destroy)
  end
end