Clarify strategy creation in runner.rb with comment
This commit is contained in:
@ -25,8 +25,10 @@ class Runner < ApplicationRecord
|
|||||||
runner = find_by(user: user, execution_environment: execution_environment)
|
runner = find_by(user: user, execution_environment: execution_environment)
|
||||||
if runner.nil?
|
if runner.nil?
|
||||||
runner = Runner.create(user: user, execution_environment: execution_environment)
|
runner = Runner.create(user: user, execution_environment: execution_environment)
|
||||||
|
# The `strategy` is added through the before_validation hook `:request_id`.
|
||||||
raise Runner::Error::Unknown.new("Runner could not be saved: #{runner.errors.inspect}") unless runner.persisted?
|
raise Runner::Error::Unknown.new("Runner could not be saved: #{runner.errors.inspect}") unless runner.persisted?
|
||||||
else
|
else
|
||||||
|
# This information is required but not persisted in the runner model.
|
||||||
runner.strategy = strategy_class.new(runner.runner_id, runner.execution_environment)
|
runner.strategy = strategy_class.new(runner.runner_id, runner.execution_environment)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user