Class: FileInventoryCleanupJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/file_inventory_cleanup_job.rb

Instance Method Summary collapse

Instance Method Details

#performObject



5
6
7
8
9
10
11
# File 'app/jobs/file_inventory_cleanup_job.rb', line 5

def perform
  FileInventoryRequest.where(["completion_time < ?", 7.days.ago]).each do |req|
    File.delete(req.output_file) if File.exist?(req.output_file)
    req.state = UserRequest::STALE
    req.save
  end
end