class CheckProjectPackageDeadlineTask
  def call
    ProjectPackage.where(status: :published).where('deadline_at < ?', Time.now).find_each do |package|
      begin
        ProjectPackages::EndBiddingService.new(package).call
      rescue => ex
        Rails.logger.error ex.message
        Rails.logger.error ex.backtrace.join('\n')
      end
    end
  end
end
