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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-20 11:43:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-20 11:43:02 +0300
commitd9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch)
tree2341ef426af70ad1e289c38036737e04b0aa5007 /lib/gitlab/checks
parentd6e514dd13db8947884cd58fe2a9c2a063400a9b (diff)
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'lib/gitlab/checks')
-rw-r--r--lib/gitlab/checks/matching_merge_request.rb32
1 files changed, 15 insertions, 17 deletions
diff --git a/lib/gitlab/checks/matching_merge_request.rb b/lib/gitlab/checks/matching_merge_request.rb
index e37cbc0442b..e5ce862264f 100644
--- a/lib/gitlab/checks/matching_merge_request.rb
+++ b/lib/gitlab/checks/matching_merge_request.rb
@@ -13,23 +13,21 @@ module Gitlab
end
def match?
- if ::Gitlab::Database::LoadBalancing.enable?
- # When a user merges a merge request, the following sequence happens:
- #
- # 1. Sidekiq: MergeService runs and updates the merge request in a locked state.
- # 2. Gitaly: The UserMergeBranch RPC runs.
- # 3. Gitaly (gitaly-ruby): This RPC calls the pre-receive hook.
- # 4. Rails: This hook makes an API request to /api/v4/internal/allowed.
- # 5. Rails: This API check does a SQL query for locked merge
- # requests with a matching SHA.
- #
- # Since steps 1 and 5 will happen on different database
- # sessions, replication lag could erroneously cause step 5 to
- # report no matching merge requests. To avoid this, we check
- # the write location to ensure the replica can make this query.
- track_session_metrics do
- ::Gitlab::Database::LoadBalancing::Sticking.select_valid_host(:project, @project.id)
- end
+ # When a user merges a merge request, the following sequence happens:
+ #
+ # 1. Sidekiq: MergeService runs and updates the merge request in a locked state.
+ # 2. Gitaly: The UserMergeBranch RPC runs.
+ # 3. Gitaly (gitaly-ruby): This RPC calls the pre-receive hook.
+ # 4. Rails: This hook makes an API request to /api/v4/internal/allowed.
+ # 5. Rails: This API check does a SQL query for locked merge
+ # requests with a matching SHA.
+ #
+ # Since steps 1 and 5 will happen on different database
+ # sessions, replication lag could erroneously cause step 5 to
+ # report no matching merge requests. To avoid this, we check
+ # the write location to ensure the replica can make this query.
+ track_session_metrics do
+ ::ApplicationRecord.sticking.select_valid_host(:project, @project.id)
end
# rubocop: disable CodeReuse/ActiveRecord