Class: Debci::Expiration
- Inherits:
-
Object
- Object
- Debci::Expiration
- Defined in:
- lib/debci/expiration.rb
Defined Under Namespace
Classes: CLI
Instance Method Summary collapse
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/debci/expiration.rb', line 17 def run expire_date = Time.now - Debci.config.data_retention.days start_date = .stat.mtime jobs = Debci::Job.where(['date >= ? AND date <= ?', start_date, expire_date]) jobs.in_batches.each do |subset| subset.each do |job| job.cleanup(reason: "past data retention period") end end FileUtils.touch(, mtime: expire_date) end |