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-03-23 12:09:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-23 12:09:17 +0300
commitb3647b2a67930e8aa3c1b1dd9bda29c368c862ba (patch)
treeb5903a88d38e6891bf4b5f7fdcedb5dcb34955b6 /app/models
parentfe6c2b9ae0af6aef067853fb20bef3d72e7978b8 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r--app/models/application_record.rb6
-rw-r--r--app/models/ci/group.rb7
-rw-r--r--app/models/ci/stage.rb1
3 files changed, 12 insertions, 2 deletions
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
index c9ae185583d..1bbace791ed 100644
--- a/app/models/application_record.rb
+++ b/app/models/application_record.rb
@@ -52,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
@@ -79,3 +79,5 @@ class ApplicationRecord < ActiveRecord::Base
enum(enum_mod.key => values)
end
end
+
+ApplicationRecord.prepend_if_ee('EE::ApplicationRecordHelpers')
diff --git a/app/models/ci/group.rb b/app/models/ci/group.rb
index 4ba09fd8152..47b91fcf2ce 100644
--- a/app/models/ci/group.rb
+++ b/app/models/ci/group.rb
@@ -22,6 +22,13 @@ module Ci
@jobs = jobs
end
+ def ==(other)
+ other.present? && other.is_a?(self.class) &&
+ project == other.project &&
+ stage == other.stage &&
+ name == other.name
+ end
+
def status
strong_memoize(:status) do
status_struct.status
diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb
index c49d088fe6b..e2103183247 100644
--- a/app/models/ci/stage.rb
+++ b/app/models/ci/stage.rb
@@ -20,6 +20,7 @@ module Ci
scope :ordered, -> { order(position: :asc) }
scope :in_pipelines, ->(pipelines) { where(pipeline: pipelines) }
+ scope :by_name, ->(names) { where(name: names) }
with_options unless: :importing? do
validates :project, presence: true