diff options
author | Stan Hu <stanhu@gmail.com> | 2018-10-30 16:41:49 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-10-30 22:29:57 -0700 |
commit | d4ef4ad752bf05758351bd0b8761566e40ab0e8e (patch) | |
tree | 8d8e3f67a217ad5b7d2dac4b0adb3f16d43f433e /lib | |
parent | 571e651b21c7a618b8686a4b3f8a8c09c87a37f5 (diff) | |
download | gitlab-ce-d4ef4ad752bf05758351bd0b8761566e40ab0e8e.tar.gz |
Reduce SQL queries needed to load open merge requestssh-optimize-merge-request-project-lookup
The SQL queries and memory allocation in MergeRequests::RefreshService
is dominated by queries for Project and Route loads. On staging, the
absence of an inverse relationship caused Rails to make over 1100
extraneous SQL queries for the www-gitlab-com repository.
Relates to https://gitlab.com/gitlab-org/gitlab-ce/issues/49703
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/import/merge_request_helpers.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab/import/merge_request_helpers.rb b/lib/gitlab/import/merge_request_helpers.rb index 97dc1a987c4..9215067d973 100644 --- a/lib/gitlab/import/merge_request_helpers.rb +++ b/lib/gitlab/import/merge_request_helpers.rb @@ -22,7 +22,7 @@ module Gitlab # additional work that is strictly necessary. merge_request_id = insert_and_return_id(attributes, project.merge_requests) - merge_request = project.merge_requests.find(merge_request_id) + merge_request = project.merge_requests.reload.find(merge_request_id) # We use .insert_and_return_id which effectively disables all callbacks. # Trigger iid logic here to make sure we track internal id values consistently. |