Commit fdd67076 by Bach Dániel

monitor: add timeout to measure_response_time()

parent d713a4fd
...@@ -32,7 +32,11 @@ logger = logging.getLogger(__name__) ...@@ -32,7 +32,11 @@ logger = logging.getLogger(__name__)
@celery.task(ignore_result=True) @celery.task(ignore_result=True)
def measure_response_time(): def measure_response_time():
r = requests.get(settings.DJANGO_URL, verify=False) try:
r = requests.get(settings.DJANGO_URL, verify=False,
timeout=0.5)
except requests.exceptions.Timeout:
return
total_miliseconds = ( total_miliseconds = (
r.elapsed.seconds * 10**6 + r.elapsed.seconds * 10**6 +
r.elapsed.microseconds) / 1000 r.elapsed.microseconds) / 1000
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment