Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] add timeouts to http reqests #151

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: |
# PyYaml is required until docker-compose is migrated to v2
pip install pyyaml==5.3.1
pip install docker==6.1.3 docker-compose
pip install docker==6.1.3 docker-compose requests==2.31.0
poetry install --no-interaction --no-ansi
docker-compose version
poetry run python -m pytest
2 changes: 1 addition & 1 deletion app/lib/node_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

def get_node_health(node_http_endpoint):
try:
return requests.get(node_http_endpoint + '/health', headers={'Content-type': 'application/json'})
return requests.get(node_http_endpoint + '/health', headers={'Content-type': 'application/json'}, timeout=1)
except Exception as err:
log.error("Failed to call /health on {}; Error: {}".format(node_http_endpoint, err))
return False
Expand Down
2 changes: 1 addition & 1 deletion app/lib/session_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def rotate_node_session_keys(node_http_endpoint):
try:
rotate_keys = requests.post(node_http_endpoint,
data='{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys", "params":[]}',
headers={'Content-type': 'application/json'})
headers={'Content-type': 'application/json'}, timeout=10)
if rotate_keys.status_code == 200:
log.info("{} session keys rotated successfully".format(node_http_endpoint))
return rotate_keys.json()['result']
Expand Down
Loading