Module: Sidekiq::Sequence::Perform

Defined in:
lib/sidekiq/sequence/perform.rb

Instance Method Summary collapse

Instance Method Details

#perform(id, *args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/sidekiq/sequence/perform.rb', line 6

def perform(id, *args)
  @record = Record.find(id)
  @data = @record.data.with_indifferent_access

  super(*args)

  # Increment the step and update data attribute.
  @record.increment(:current_step)
  @record.data = @data
  @record.save!

  # Perform the next in sequence.
  if ::Rails.version.to_f >= 6.0
    self.class.module_parent.perform_step @record.current_step, @record.id
  else
    self.class.parent.perform_step @record.current_step, @record.id
  end
end