canonical / canonical/serialized-data-interface

`requests.get()` calls should use a `timeout`

Open
#40 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
0
Forks
2
PR merge metrics
No merged PRs in 30d

Description

[_get_schema_response_from_remote()](https://github.com/canonical/serialized-data-interface/blob/d1fad1e6c397df31adeee0a5a93e1cedebd73034/serialized_data_interface/utils.py#L75) makes `requests.get()` calls, but we've found that when they do not have connectivity (no internet, incorrect proxy settings, etc) these requests hang indefinitely. This is because they by default do not have a [timeout](https://requests.readthedocs.io/en/latest/user/advanced/#timeouts) as is suggested by requests. This makes it hard to debug as, rather than seeing a failure due to connectivity, users just see a charm stuck in a hook execution.

Recommended that we set a `timeout` here, maybe in the order of 10s?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.