debian-mirror-gitlab/app/models/merge_request/cleanup_schedule.rb
2021-01-29 00:20:46 +05:30

14 lines
392 B
Ruby

# 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