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:
authorStan Hu <stanhu@gmail.com>2019-06-21 01:18:51 +0300
committerStan Hu <stanhu@gmail.com>2019-06-21 01:59:41 +0300
commit1b7ab11f9489690149f7ff1b78a927e5b3bbcfe0 (patch)
tree21d761c3baf2c37021c67b753e475be266b9aae8 /app/helpers/issuables_helper.rb
parent61a2ed5d0ec945e17f10b01c3eb1fc9e22c87bb1 (diff)
Omit issues links in merge request entity API response
The merge request widget has a section that includes which issues may be closed or mentioned based on the merge request description. The problem is that rendering and redacting Markdown can be expensive, especially since the browser polls for the data every 10 seconds. Since these links don't change much and are just nice to have, we only load them on first page load. The frontend will use the existing data if the data doesn't appear on subsequent requests. This saves about 30% of the rendering time of this endpoint, which adds up to significant savings considering that `MergeRequestsController#show.json` is called over a million times a day on GitLab.com. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/63546
Diffstat (limited to 'app/helpers/issuables_helper.rb')
-rw-r--r--app/helpers/issuables_helper.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb
index 9a12db258d5..150f24a5d5b 100644
--- a/app/helpers/issuables_helper.rb
+++ b/app/helpers/issuables_helper.rb
@@ -74,7 +74,7 @@ module IssuablesHelper
end
end
- def serialize_issuable(issuable, serializer: nil)
+ def serialize_issuable(issuable, opts = {})
serializer_klass = case issuable
when Issue
IssueSerializer
@@ -84,7 +84,7 @@ module IssuablesHelper
serializer_klass
.new(current_user: current_user, project: issuable.project)
- .represent(issuable, serializer: serializer)
+ .represent(issuable, opts)
.to_json
end