From 802f35d65005ccda79fc9870dd3ae7959d68d621 Mon Sep 17 00:00:00 2001 From: Connor Osborn Date: Wed, 1 Aug 2018 13:55:57 -0700 Subject: [PATCH] Set 5 sec timeout for calls to tas.api The tas api averages about 500ms, but occasionally goes to 3,5,10 sec. This upperbound is to limit how long api/v1/profile will take in the worst case. --- jetstream/tas_api.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jetstream/tas_api.py b/jetstream/tas_api.py index ce8ebc9f1..95324426c 100644 --- a/jetstream/tas_api.py +++ b/jetstream/tas_api.py @@ -16,7 +16,8 @@ def tacc_api_post(url, post_data, username=None, password=None): # logger.debug("REQ BODY: %s" % post_data) resp = requests.post( url, post_data, - auth=(username, password)) + auth=(username, password), + timeout=5) logger.debug('resp.status_code: %s', resp.status_code) # logger.debug('resp.__dict__: %s', resp.__dict__) return resp @@ -31,7 +32,8 @@ def tacc_api_get(url, username=None, password=None): logger.debug('url: %s', url) resp = requests.get( url, - auth=(username, password)) + auth=(username, password), + timeout=5) logger.debug('resp.status_code: %s', resp.status_code) # logger.debug('resp.__dict__: %s', resp.__dict__) if resp.status_code != 200: