'This method will pause all scan threads for an increasing period of time
based on the HTTP error rate. HTTP errors are timeouts, network
unreachable, etc. things like 404, 403, 500 are NOT considered errors.
The objective of this method is to give the remote server, or local
connection, the chance to recover from their errors without killing the
w3af scan.
When the error rate is lower than 5% nothing is done. We accept some
errors.
If error rate is higher we delay the threads for some time, give the
remote server/local connection time to recover, and then continue with
the scan as usual.
The error rate is multiplied by SOCKET_ERROR_DELAY to get the real delay
time in seconds.
The error rate starts at zero, so no delay is added at the beginning
:return: None, but might delay the requests which go out to the network
:see: https://github.com/andresriancho/w3af/issues/4811
:see: https://github.com/andresriancho/w3af/issues/8852'

def _pause_on_http_error(self, request):

    with self._rate_limit_lock:
        error_rate = self.get_error_rate()
        if (not self._should_pause_on_http_error(error_rate)):
            return
        (pending_pause, lower_error_rate) = self._has_pending_pause(error_rate)
        if (not pending_pause):
            return
        error_sleep = (SOCKET_ERROR_DELAY * error_rate)
        msg = 'Sleeping    for    %s    seconds    before    sending    HTTP    request    to    "%s"    after    receiving    URL/socket    error.    The    ExtendedUrllib    error    rate    is    at    %s%%.'
        args = (error_sleep, request.url_object, error_rate)
        om.out.debug((msg % args))
        time.sleep(error_sleep)
        self._sleep_log[lower_error_rate] = True
        if ((self.get_total_requests() % 100) == 0):
            self._clear_sleep_log()
