Class: RailsLiveDashboard::Recorders::Jobs::StartRecorder

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_live_dashboard/recorders/jobs/start_recorder.rb

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ StartRecorder

Returns a new instance of StartRecorder.



5
6
7
8
# File 'lib/rails_live_dashboard/recorders/jobs/start_recorder.rb', line 5

def initialize(event)
  @event = event
  @job = Job.same(@event.payload[:job].job_id).first
end

Instance Method Details

#executeObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/rails_live_dashboard/recorders/jobs/start_recorder.rb', line 10

def execute
  raise Exceptions::EntryNotFound.new(:job, @event.payload[:job].job_id) if @job.nil?

  Current.batch_id = @job.batch_id

  build_content
  build_history

  @job.update(content:)
end