Class: ActiveJobStatus::JobTracker
- Inherits:
-
Object
- Object
- ActiveJobStatus::JobTracker
- Defined in:
- lib/active_job_status/job_tracker.rb
Constant Summary collapse
- DEFAULT_EXPIRATION =
72.hours.freeze
Instance Method Summary collapse
- #completed ⇒ Object
- #deleted ⇒ Object
- #enqueued ⇒ Object
-
#initialize(job_id:, store: ActiveJobStatus.store, expiration: ActiveJobStatus.expiration) ⇒ JobTracker
constructor
A new instance of JobTracker.
- #performing ⇒ Object
Constructor Details
#initialize(job_id:, store: ActiveJobStatus.store, expiration: ActiveJobStatus.expiration) ⇒ JobTracker
Returns a new instance of JobTracker.
5 6 7 8 9 |
# File 'lib/active_job_status/job_tracker.rb', line 5 def initialize(job_id:, store: ActiveJobStatus.store, expiration: ActiveJobStatus.expiration) @job_id = job_id @store = store @expiration = expiration end |
Instance Method Details
#completed ⇒ Object
26 27 28 29 30 31 |
# File 'lib/active_job_status/job_tracker.rb', line 26 def completed store.write( job_id, JobStatus::COMPLETED.to_s ) end |
#deleted ⇒ Object
33 34 35 |
# File 'lib/active_job_status/job_tracker.rb', line 33 def deleted store.delete(job_id) end |
#enqueued ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/active_job_status/job_tracker.rb', line 11 def enqueued store.write( job_id, JobStatus::ENQUEUED.to_s, expires_in: expiration || DEFAULT_EXPIRATION ) end |