Module: CanvasSync::JobBatches::Compat::ActiveJob::BatchAwareJob
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/canvas_sync/job_batches/compat/active_job.rb
Instance Method Summary collapse
- #batch ⇒ Object
- #batch_context ⇒ Object
- #bid ⇒ Object
- #deserialize(data) ⇒ Object
- #serialize ⇒ Object
- #valid_within_batch? ⇒ Boolean
Instance Method Details
#batch ⇒ Object
41 42 43 |
# File 'lib/canvas_sync/job_batches/compat/active_job.rb', line 41 def batch Thread.current[CURRENT_BATCH_THREAD_KEY] end |
#batch_context ⇒ Object
45 46 47 |
# File 'lib/canvas_sync/job_batches/compat/active_job.rb', line 45 def batch_context batch&.context || {} end |
#bid ⇒ Object
37 38 39 |
# File 'lib/canvas_sync/job_batches/compat/active_job.rb', line 37 def bid @bid || Thread.current[CURRENT_BATCH_THREAD_KEY]&.bid end |
#deserialize(data) ⇒ Object
60 61 62 63 |
# File 'lib/canvas_sync/job_batches/compat/active_job.rb', line 60 def deserialize(data) super @bid = data['batch_id'] end |
#serialize ⇒ Object
53 54 55 56 57 58 |
# File 'lib/canvas_sync/job_batches/compat/active_job.rb', line 53 def serialize super.tap do |data| data['batch_id'] = @bid # This _must_ be @bid - not just bid data end end |
#valid_within_batch? ⇒ Boolean
49 50 51 |
# File 'lib/canvas_sync/job_batches/compat/active_job.rb', line 49 def valid_within_batch? batch.valid? end |