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, 4 insertions, 6 deletions
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
index 44d1b6cf907..1bbace791ed 100644
--- a/app/models/application_record.rb
+++ b/app/models/application_record.rb
@@ -42,10 +42,6 @@ class ApplicationRecord < ActiveRecord::Base
false
end
- def self.at_most(count)
- limit(count)
- end
-
def self.safe_find_or_create_by!(*args, &block)
safe_find_or_create_by(*args, &block).tap do |record|
raise ActiveRecord::RecordNotFound unless record.present?
@@ -56,9 +52,9 @@ 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_statement_timeout
+ def self.with_fast_read_statement_timeout(timeout_ms = 5000)
transaction(requires_new: true) do
- connection.exec_query("SET LOCAL statement_timeout = 5000")
+ connection.exec_query("SET LOCAL statement_timeout = #{timeout_ms}")
yield
end
@@ -83,3 +79,5 @@ class ApplicationRecord < ActiveRecord::Base
enum(enum_mod.key => values)
end
end
+
+ApplicationRecord.prepend_if_ee('EE::ApplicationRecordHelpers')