diff --git a/queue_job/jobrunner/runner.py b/queue_job/jobrunner/runner.py index 0e334c17f..fa5aeee61 100644 --- a/queue_job/jobrunner/runner.py +++ b/queue_job/jobrunner/runner.py @@ -176,6 +176,9 @@ def _odoo_now(): return _datetime_to_epoch(dt) +session = requests.Session() + + def _async_http_get(scheme, host, port, user, password, db_name, job_uuid): # Method to set failed job (due to timeout, etc) as pending, # to avoid keeping it as enqueued. @@ -202,7 +205,7 @@ def urlopen(): auth = (user, password) # we are not interested in the result, so we set a short timeout # but not too short so we trap and log hard configuration errors - response = requests.get(url, timeout=1, auth=auth) + response = session.get(url, timeout=1, auth=auth) # raise_for_status will result in either nothing, a Client Error # for HTTP Response codes between 400 and 500 or a Server Error