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/checks/matching_merge_request.rb')
-rw-r--r--lib/gitlab/checks/matching_merge_request.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/gitlab/checks/matching_merge_request.rb b/lib/gitlab/checks/matching_merge_request.rb
index 15178597a99..d0644856105 100644
--- a/lib/gitlab/checks/matching_merge_request.rb
+++ b/lib/gitlab/checks/matching_merge_request.rb
@@ -26,8 +26,10 @@ module Gitlab
# 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.
+ # Adding use_primary_on_empty_location: true for extra precaution in case there happens to be
+ # no LSN saved for the project then we will use the primary.
track_session_metrics do
- ::ApplicationRecord.sticking.select_valid_host(:project, @project.id)
+ ::ApplicationRecord.sticking.find_caught_up_replica(:project, @project.id, use_primary_on_empty_location: true)
end
# rubocop: disable CodeReuse/ActiveRecord