Class: CompletionKit::StartRunJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/completion_kit/start_run_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(run_id, scope_defaults = {}) ⇒ Object

scope_defaults carries the host's tenant columns, resolved in the web request where the tenant context exists. A worker has no such context, so without them the inserted responses would be stamped with nothing.



18
19
20
21
22
23
24
25
26
27
# File 'app/jobs/completion_kit/start_run_job.rb', line 18

def perform(run_id, scope_defaults = {})
  @run_id = run_id

  run = Run.find_by(id: run_id)
  return unless run
  return unless run.status == "running"
  return if run.responses.exists?

  run.execute_start!(scope_defaults.symbolize_keys)
end