Skip to content
This repository has been archived by the owner on Sep 12, 2022. It is now read-only.

Commit

Permalink
Set 5 sec timeout for calls to tas.api
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cdosborn committed Aug 1, 2018
1 parent 4072f1a commit 802f35d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jetstream/tas_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 802f35d

Please sign in to comment.