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:
Diffstat (limited to 'lib/gitlab/etag_caching/router.rb')
-rw-r--r--lib/gitlab/etag_caching/router.rb30
1 files changed, 20 insertions, 10 deletions
diff --git a/lib/gitlab/etag_caching/router.rb b/lib/gitlab/etag_caching/router.rb
index 684afc6762a..754b54fda81 100644
--- a/lib/gitlab/etag_caching/router.rb
+++ b/lib/gitlab/etag_caching/router.rb
@@ -3,24 +3,34 @@
module Gitlab
module EtagCaching
module Router
- Route = Struct.new(:router, :regexp, :name, :feature_category, :caller_id) do
+ Route = Struct.new(:router, :regexp, :name, :feature_category, :caller_id, :urgency, keyword_init: true) do
delegate :match, to: :regexp
delegate :cache_key, to: :router
end
module Helpers
- def build_route(attrs)
- EtagCaching::Router::Route.new(self, *attrs)
+ def build_graphql_route(regexp, name, feature_category)
+ EtagCaching::Router::Route.new(
+ router: self,
+ regexp: regexp,
+ name: name,
+ feature_category: feature_category,
+ # This information can be loaded from the graphql query, but is not
+ # included yet
+ # https://gitlab.com/groups/gitlab-com/gl-infra/-/epics/665
+ caller_id: nil,
+ urgency: Gitlab::EndpointAttributes::DEFAULT_URGENCY
+ )
end
- def build_rails_route(attrs)
- regexp, name, controller, action_name = *attrs
+ def build_rails_route(regexp, name, controller, action_name)
EtagCaching::Router::Route.new(
- self,
- regexp,
- name,
- controller.feature_category_for_action(action_name).to_s,
- controller.endpoint_id_for_action(action_name).to_s
+ router: self,
+ regexp: regexp,
+ name: name,
+ feature_category: controller.feature_category_for_action(action_name).to_s,
+ caller_id: controller.endpoint_id_for_action(action_name).to_s,
+ urgency: controller.urgency_for_action(action_name)
)
end
end