Skip to content

Commit

Permalink
Added timeout to github request and handled ConnectionError exception
Browse files Browse the repository at this point in the history
  • Loading branch information
simontorres committed Aug 17, 2023
1 parent a2b34f7 commit 800a39c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion goodman_pipeline/core/check_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_last(github_api_token='GITHUB_ACCESS_TOKEN'):
except KeyError:
headers = {}

response = requests.get(API_URL, headers=headers)
response = requests.get(API_URL, headers=headers, timeout=3)

if response.status_code != 200: # pragma: no cover
raise ConnectionRefusedError('Number of tests reached maximum for now.')
Expand Down
5 changes: 4 additions & 1 deletion goodman_pipeline/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2958,7 +2958,10 @@ def setup_logging(debug=False, generic=False): # pragma: no cover
log.info("Latest Release: {:s}".format(latest_release))
except ConnectionRefusedError:
log.error('Unauthorized GitHub API Access reached maximum')
log.info("Current Version: {:s}".format(__version__))
log.info(f"Current Version: {__version__}")
except ConnectionError:
log.error("The connection timed out or was not possible to establish")
log.info(f"Current Version: {__version__}")


def trace(ccd,
Expand Down

0 comments on commit 800a39c

Please sign in to comment.