Commit 2a7f1eec authored by Lin Jen-Shin's avatar Lin Jen-Shin

Memorize the value in methods rather than local

parent 98b60ee2
...@@ -14,10 +14,8 @@ class CreateDeploymentService ...@@ -14,10 +14,8 @@ class CreateDeploymentService
return unless executable? return unless executable?
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
if external_url = expanded_environment_url environment.external_url = expanded_environment_url if
environment.external_url = external_url expanded_environment_url
end
environment.fire_state_event(action) environment.fire_state_event(action)
return unless environment.save return unless environment.save
...@@ -53,8 +51,14 @@ class CreateDeploymentService ...@@ -53,8 +51,14 @@ class CreateDeploymentService
end end
def expanded_environment_url def expanded_environment_url
ExpandVariables.expand(environment_options[:url], variables) if return @expanded_environment_url if defined?(@expanded_environment_url)
environment_options[:url]
@expanded_environment_url =
ExpandVariables.expand(environment_url, variables) if environment_url
end
def environment_url
environment_options[:url]
end end
def on_stop def on_stop
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment