diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-05-12 15:19:27 +0200 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-05-22 21:55:43 +0200 |
commit | ebede2b3ff1c2b089529c4f9d6268641580e280b (patch) | |
tree | 08d0463762501180bf45444cd88cacf085e9bcd4 /lib | |
parent | 50a00442285973a390fa448d189ee43cd700d668 (diff) | |
download | gitlab-ce-ebede2b3ff1c2b089529c4f9d6268641580e280b.tar.gz |
Use etag caching for environments JSON
For the index view, the environments can now be requested every 15
seconds. Any transition state of a projects environments will trigger a
cache invalidation action.
Fixes gitlab-org/gitlab-ce#31701
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/etag_caching/router.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/gitlab/etag_caching/router.rb b/lib/gitlab/etag_caching/router.rb index ba31041d0c1..01bf578c570 100644 --- a/lib/gitlab/etag_caching/router.rb +++ b/lib/gitlab/etag_caching/router.rb @@ -7,9 +7,10 @@ module Gitlab # - Don't contain a reserved word (expect for the words used in the # regex itself) # - Ending in `noteable/issue/<id>/notes` for the `issue_notes` route - # - Ending in `issues/id`/realtime_changes` for the `issue_title` route + # - Ending in `issues/id`/rendered_title` for the `issue_title` route USED_IN_ROUTES = %w[noteable issue notes issues realtime_changes - commit pipelines merge_requests new].freeze + commit pipelines merge_requests new + environments].freeze RESERVED_WORDS = DynamicPathValidator::WILDCARD_ROUTES - USED_IN_ROUTES RESERVED_WORDS_REGEX = Regexp.union(*RESERVED_WORDS) ROUTES = [ @@ -40,6 +41,10 @@ module Gitlab Gitlab::EtagCaching::Router::Route.new( %r(^(?!.*(#{RESERVED_WORDS})).*/pipelines/\d+\.json\z), 'project_pipeline' + ), + Gitlab::EtagCaching::Router::Route.new( + %r(^(?!.*(#{RESERVED_WORDS_REGEX})).*/environments\.json\z), + 'environments' ) ].freeze |