diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-12 15:09:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-12 15:09:39 +0300 |
commit | 4a31b8786892820e8029844c34fd5296c52c37c0 (patch) | |
tree | ef04909e73e0ffe6e4c2b0d40408cada88aa5afc /app/models/merge_request | |
parent | 1fdf76252e8fdf1a30826fe3f32a6216e50c563c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/merge_request')
-rw-r--r-- | app/models/merge_request/cleanup_schedule.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/merge_request/cleanup_schedule.rb b/app/models/merge_request/cleanup_schedule.rb new file mode 100644 index 00000000000..79817269be2 --- /dev/null +++ b/app/models/merge_request/cleanup_schedule.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class MergeRequest::CleanupSchedule < ApplicationRecord + belongs_to :merge_request, inverse_of: :cleanup_schedule + + validates :scheduled_at, presence: true + + def self.scheduled_merge_request_ids(limit) + where('completed_at IS NULL AND scheduled_at <= NOW()') + .order('scheduled_at DESC') + .limit(limit) + .pluck(:merge_request_id) + end +end |