BE feedback: memoize deployment_metrics
Also memoize has_metrics? as well, that might be expensive, and it should not change for the lifetime of EnvironmentStatus
This commit is contained in:
parent
c85d6b0c74
commit
792455450a
1 changed files with 7 additions and 1 deletions
|
@ -34,7 +34,9 @@ class EnvironmentStatus
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_metrics?
|
def has_metrics?
|
||||||
DeploymentMetrics.new(project, deployment).has_metrics?
|
strong_memoize(:has_metrics) do
|
||||||
|
deployment_metrics.has_metrics?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def changes
|
def changes
|
||||||
|
@ -52,6 +54,10 @@ class EnvironmentStatus
|
||||||
|
|
||||||
PAGE_EXTENSIONS = /\A\.(s?html?|php|asp|cgi|pl)\z/i.freeze
|
PAGE_EXTENSIONS = /\A\.(s?html?|php|asp|cgi|pl)\z/i.freeze
|
||||||
|
|
||||||
|
def deployment_metrics
|
||||||
|
@deployment_metrics ||= DeploymentMetrics.new(project, deployment)
|
||||||
|
end
|
||||||
|
|
||||||
def build_change(file)
|
def build_change(file)
|
||||||
public_path = project.public_path_for_source_path(file.new_path, sha)
|
public_path = project.public_path_for_source_path(file.new_path, sha)
|
||||||
return if public_path.nil?
|
return if public_path.nil?
|
||||||
|
|
Loading…
Reference in a new issue