check_connection_pool_stats!

in lib/crawler/http_client.rb [360:381]


    def check_connection_pool_stats!
      stats = connection_pool_stats
      used_connections = stats.leased + stats.available

      if used_connections >= stats.max
        logger.error(<<~LOG.squish)
          HTTP client connection pool is full!
          If the issue persists, it may be an indication of an issue with the remote server
          or a problem with the crawler. Current pool status: 
        LOG
      elsif used_connections >= stats.max * 0.9
        logger.warn(<<~LOG.squish)
          HTTP client connection pool is 90% full!
          If we hit the 100% utilization, the crawler will not be able to request any more pages
          from the remote server. This may be an indication of an issue with the remote server
          or a problem with the crawler. Current pool status: 
        LOG
      else
        logger.debug("Connection pool stats: #{stats}")
      end
    end