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/release.rb')
-rw-r--r--app/models/release.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/release.rb b/app/models/release.rb
index 1cd623e1254..7bacc69f038 100644
--- a/app/models/release.rb
+++ b/app/models/release.rb
@@ -54,6 +54,7 @@ class Release < ApplicationRecord
scope :recent, -> { sorted.limit(MAX_NUMBER_TO_DISPLAY) }
scope :without_evidence, -> { left_joins(:evidences).where(::Releases::Evidence.arel_table[:id].eq(nil)) }
scope :released_within_2hrs, -> { where(released_at: Time.zone.now - 1.hour..Time.zone.now + 1.hour) }
+ scope :unpublished, -> { where(release_published_at: nil) }
scope :for_projects, ->(projects) { where(project_id: projects) }
scope :by_tag, ->(tag) { where(tag: tag) }
@@ -66,6 +67,7 @@ class Release < ApplicationRecord
delegate :repository, to: :project
MAX_NUMBER_TO_DISPLAY = 3
+ MAX_NUMBER_TO_PUBLISH = 5000
class << self
# In the future, we should support `order_by=semver`;
@@ -97,6 +99,10 @@ class Release < ApplicationRecord
.from("(VALUES #{project_ids_list}) projects (id)")
.joins("INNER JOIN LATERAL (#{join_query.to_sql}) #{Release.table_name} ON TRUE")
end
+
+ def waiting_for_publish_event
+ unpublished.released_within_2hrs.joins(:project).merge(Project.with_feature_enabled(:releases)).limit(MAX_NUMBER_TO_PUBLISH)
+ end
end
def to_param