Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-06-07 11:27:52 +0300
committerPawel Chojnacki <pawel@chojnacki.ws>2017-06-07 11:27:52 +0300
commitdbb3c28088b63c8cf40a90c599b6eedb4dfbbb66 (patch)
tree9e6c4d495e45355ef62c56c0c3e102f95220f89f /app/models/environment.rb
parenta924152219c1367bf494f3f387d050ac3ff2d7d3 (diff)
parentdddc54aa0aea4088e5a233d18a62cb2435590fe9 (diff)
Merge remote-tracking branch 'upstream/master' into 28717-additional-metrics-review-branch
# Conflicts: # app/models/project_services/prometheus_service.rb # app/views/projects/services/_form.html.haml
Diffstat (limited to 'app/models/environment.rb')
-rw-r--r--app/models/environment.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb
index 9b7dc7f807e..94815f99e9f 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -57,6 +57,10 @@ class Environment < ActiveRecord::Base
state :available
state :stopped
+
+ after_transition do |environment|
+ environment.expire_etag_cache
+ end
end
def predefined_variables
@@ -210,6 +214,18 @@ class Environment < ActiveRecord::Base
[external_url, public_path].join('/')
end
+ def expire_etag_cache
+ Gitlab::EtagCaching::Store.new.tap do |store|
+ store.touch(etag_cache_key)
+ end
+ end
+
+ def etag_cache_key
+ Gitlab::Routing.url_helpers.namespace_project_environments_path(
+ project.namespace,
+ project)
+ end
+
private
# Slugifying a name may remove the uniqueness guarantee afforded by it being