Class: Workhorse::Jobs::CleanupSucceededJobs
- Inherits:
-
Object
- Object
- Workhorse::Jobs::CleanupSucceededJobs
- Defined in:
- lib/workhorse/jobs/cleanup_succeeded_jobs.rb
Instance Method Summary collapse
-
#initialize(max_age: 14) ⇒ CleanupSucceededJobs
constructor
Instantiates a new job.
- #perform ⇒ Object
Constructor Details
#initialize(max_age: 14) ⇒ CleanupSucceededJobs
Instantiates a new job.
7 8 9 |
# File 'lib/workhorse/jobs/cleanup_succeeded_jobs.rb', line 7 def initialize(max_age: 14) @max_age = max_age end |
Instance Method Details
#perform ⇒ Object
11 12 13 14 15 16 |
# File 'lib/workhorse/jobs/cleanup_succeeded_jobs.rb', line 11 def perform age_limit = seconds_ago(@max_age) Workhorse::DbJob.where( 'STATE = ? AND UPDATED_AT <= ?', Workhorse::DbJob::STATE_SUCCEEDED, age_limit ).delete_all end |