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 'app/models/application_record.rb')
-rw-r--r--app/models/application_record.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
index 5e5bc00458e..a93348a3b27 100644
--- a/app/models/application_record.rb
+++ b/app/models/application_record.rb
@@ -53,10 +53,12 @@ class ApplicationRecord < ActiveRecord::Base
# Start a new transaction with a shorter-than-usual statement timeout. This is
# currently one third of the default 15-second timeout
def self.with_fast_read_statement_timeout(timeout_ms = 5000)
- transaction(requires_new: true) do
- connection.exec_query("SET LOCAL statement_timeout = #{timeout_ms}")
+ ::Gitlab::Database::LoadBalancing::Session.current.fallback_to_replicas_for_ambiguous_queries do
+ transaction(requires_new: true) do
+ connection.exec_query("SET LOCAL statement_timeout = #{timeout_ms}")
- yield
+ yield
+ end
end
end
@@ -85,5 +87,3 @@ class ApplicationRecord < ActiveRecord::Base
enum(enum_mod.key => values)
end
end
-
-ApplicationRecord.prepend_mod_with('ApplicationRecordHelpers')