Module: Resque::Pertry::Persistence::ClassMethods
- Defined in:
- lib/resque/pertry/persistence.rb
Instance Method Summary collapse
-
#after_perform_pertry_00_persistence(args = {}) ⇒ Object
Resque after_perform hook (job completed successfully).
-
#before_enqueue_pertry_99_persistence(args = {}) ⇒ Object
Resque before_enqueue hook.
- #non_persistent ⇒ Object (also: #non_durable)
-
#persistent ⇒ Object
(also: #durable)
Set job as persistent.
-
#persistent? ⇒ Boolean
Check if job is persistent.
Instance Method Details
#after_perform_pertry_00_persistence(args = {}) ⇒ Object
Resque after_perform hook (job completed successfully)
49 50 51 52 53 |
# File 'lib/resque/pertry/persistence.rb', line 49 def after_perform_pertry_00_persistence(args = {}) return unless persistent? ResquePertryPersistence.finnish_job(self, args) end |
#before_enqueue_pertry_99_persistence(args = {}) ⇒ Object
Resque before_enqueue hook
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/resque/pertry/persistence.rb', line 32 def before_enqueue_pertry_99_persistence(args = {}) pertry_key = Resque::Plugins::Pertry::JOB_HASH.to_s args[pertry_key] ||= {} args[pertry_key]['audit_id'] ||= UUIDTools::UUID.random_create.to_s args[pertry_key]['queue_time'] ||= Time.now args[pertry_key]['persist'] = persistent? if persistent? ResquePertryPersistence.create_job_if_needed(self, args) end # continue with enqueue true end |
#non_persistent ⇒ Object Also known as: non_durable
21 22 23 |
# File 'lib/resque/pertry/persistence.rb', line 21 def non_persistent self._persistent = false end |
#persistent ⇒ Object Also known as: durable
Set job as persistent
16 17 18 |
# File 'lib/resque/pertry/persistence.rb', line 16 def persistent self._persistent = true end |
#persistent? ⇒ Boolean
Check if job is persistent
27 28 29 |
# File 'lib/resque/pertry/persistence.rb', line 27 def persistent? !!self._persistent end |