# File lib/mongo/server/connection_pool/queue.rb, line 197
        def enqueue(connection)
          check_count_invariants
          mutex.synchronize do
            if connection.generation == @generation
              queue.unshift(connection.record_checkin!)
              resource.broadcast
            else
              connection.disconnect!

              @pool_size = if @pool_size > 0
                @pool_size - 1
              else
                # This should never happen
                log_warn("ConnectionPool::Queue: unexpected enqueue")
                0
              end

              while @pool_size < min_size
                @pool_size += 1
                queue.unshift(@block.call(@generation))
              end
            end
          end
          nil
        ensure
          check_count_invariants
        end