Module: CanvasSync::JobUniqueness::Compat::ActiveJob::UniqueJobExtension

Extended by:
ActiveSupport::Concern
Defined in:
lib/canvas_sync/job_uniqueness/compat/active_job.rb

Instance Method Summary collapse

Instance Method Details

#deserialize(data) ⇒ Object



42
43
44
45
# File 'lib/canvas_sync/job_uniqueness/compat/active_job.rb', line 42

def deserialize(data)
  super
  @uniqueness_cache_data = data['uniqueness_cache_data']&.symbolize_keys
end

#serializeObject



36
37
38
39
40
# File 'lib/canvas_sync/job_uniqueness/compat/active_job.rb', line 36

def serialize
  super.tap do |data|
    data['uniqueness_cache_data'] = @uniqueness_cache_data.stringify_keys
  end
end

#uniqueness_lock_contextObject



47
48
49
50
51
52
53
54
55
# File 'lib/canvas_sync/job_uniqueness/compat/active_job.rb', line 47

def uniqueness_lock_context
  ActiveJobLockContext.new({
    job_clazz: self.class,
    jid: self.job_id,
    args: self.arguments,
    queue: self.queue_name,
    **(@uniqueness_cache_data || {})
  }, job_instance: self)
end