def validate_partial_uploads!(part_uids)
      input = Queue.new
      part_uids.each { |part_uid| input << part_uid }
      input.close

      results = Queue.new

      thread_count   = storage.concurrency[:concatenation] if storage.respond_to?(:concurrency)
      thread_count ||= 10

      threads = thread_count.times.map do
        Thread.new do
          begin
            loop do
              part_uid = input.pop or break
              part_info = storage.read_info(part_uid)
              results << Tus::Info.new(part_info)
            end
            nil
          rescue => error
            input.clear
            error
          end
        end
      end

      errors = threads.map(&:value).compact

      if errors.any? { |error| error.is_a?(Tus::NotFound) }
        error!(400, "One or more partial uploads were not found")
      elsif errors.any?
        fail errors.first
      end

      part_infos = Array.new(results.size) { results.pop } # convert Queue into an Array

      unless part_infos.all?(&:partial?)
        error!(400, "One or more uploads were not partial")
      end

      if max_size && part_infos.map(&:length).inject(0, :+) > max_size
        error!(400, "The sum of partial upload lengths exceed Tus-Max-Size")
      end
    end
def validate_partial_uploads!(part_uids)
      input = Queue.new
      part_uids.each { |part_uid| input << part_uid }
      input.close

      results = Queue.new

      thread_count   = storage.concurrency[:concatenation] if storage.respond_to?(:concurrency)
      thread_count ||= 10

      threads = thread_count.times.map do
        Thread.new do
          begin
            loop do
              part_uid = input.pop or break
              part_info = storage.read_info(part_uid)
              results << Tus::Info.new(part_info)
            end
            nil
          rescue => error
            input.clear
            error
          end
        end
      end

      errors = threads.map(&:value).compact

      if errors.any? { |error| error.is_a?(Tus::NotFound) }
        error!(400, "One or more partial uploads were not found")
      elsif errors.any?
        fail errors.first
      end

      part_infos = Array.new(results.size) { results.pop } # convert Queue into an Array

      unless part_infos.all?(&:partial?)
        error!(400, "One or more uploads were not partial")
      end

      if max_size && part_infos.map(&:length).inject(0, :+) > max_size
        error!(400, "The sum of partial upload lengths exceed Tus-Max-Size")
      end
    end
Validates that each partial upload exists and is marked as one.