Class: ActiveJobStore::Store
- Inherits:
-
Object
- Object
- ActiveJobStore::Store
- Defined in:
- lib/active_job_store/store.rb
Constant Summary collapse
- DETAILS_ATTRS =
%w[exception_executions executions priority queue_name scheduled_at timezone].freeze
Instance Attribute Summary collapse
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
- #around_enqueue(job) ⇒ Object
- #around_perform(job) ⇒ Object
- #update_job_custom_data(custom_data) ⇒ Object
Instance Attribute Details
#record ⇒ Object (readonly)
Returns the value of attribute record.
7 8 9 |
# File 'lib/active_job_store/store.rb', line 7 def record @record end |
Instance Method Details
#around_enqueue(job) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/active_job_store/store.rb', line 9 def around_enqueue(job) prepare_record_on_enqueue(job) lock_record! result = yield job_enqueued! job.active_job_store_internal_error('ActiveJobStore::Store around_enqueue', internal_error) if internal_error result end |
#around_perform(job) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/active_job_store/store.rb', line 18 def around_perform(job) prepare_record_on_perform(job) job_started! result = yield formatted_result = job.active_job_store_format_result(result) job_competed!(custom_data: job.active_job_store_custom_data, result: formatted_result) job.active_job_store_internal_error('ActiveJobStore::Store around_perform', internal_error) if internal_error result rescue StandardError => e job_failed!(exception: e, custom_data: job.active_job_store_custom_data) raise end |
#update_job_custom_data(custom_data) ⇒ Object
31 32 33 34 35 |
# File 'lib/active_job_store/store.rb', line 31 def update_job_custom_data(custom_data) wrap_errors do record.update!(custom_data: custom_data) end end |