class DeleteUnpublishVideoJob < ApplicationJob
  queue_as :delete

  def perform(*args)
    # "清理过时视频，一周之前用户还未确定上传的视频"
    videos = Video.where(transcoded: false, delete_state: nil, status: 'pending').where("updated_at < '#{Time.now.days_ago(7)}'")
    videos.find_each do |d|
      d.destroy
    end
  end
end
