only calculate delay if enabled
This commit is contained in:
@@ -309,12 +309,13 @@ class Application(ApplicationPartDelete, ApplicationPartHead,
|
|||||||
flags_text = ""
|
flags_text = ""
|
||||||
# delay on error
|
# delay on error
|
||||||
if status >= 400:
|
if status >= 400:
|
||||||
random_delay = self._delay_on_error * (1 + random.random())
|
if self._delay_on_error > 0:
|
||||||
if status >= 500:
|
random_delay = self._delay_on_error * (1 + random.random())
|
||||||
random_delay = 2 * random_delay
|
if status >= 500:
|
||||||
if logger.isEnabledFor(logging.DEBUG):
|
random_delay = 2 * random_delay
|
||||||
logger.debug("Response delay triggered by result code: %d -> %0.3f seconds", status, random_delay)
|
if logger.isEnabledFor(logging.DEBUG):
|
||||||
time.sleep(random_delay)
|
logger.debug("Response delay triggered by result code: %d -> %0.3f seconds", status, random_delay)
|
||||||
|
time.sleep(random_delay)
|
||||||
if answer is not None:
|
if answer is not None:
|
||||||
logger.info("%s response status for %r%s in %.3f seconds %s %s bytes%s: %s",
|
logger.info("%s response status for %r%s in %.3f seconds %s %s bytes%s: %s",
|
||||||
request_method, unsafe_path, depthinfo,
|
request_method, unsafe_path, depthinfo,
|
||||||
|
|||||||
Reference in New Issue
Block a user