Skip to content

Fix: Set a timeout to prevent the call from hanging up #113 - #114

Open
wataru-sakamoto wants to merge 1 commit into
SigmaHQ:mainfrom
wataru-sakamoto:fix-issue-113
Open

wataru-sakamoto wants to merge 1 commit into
SigmaHQ:mainfrom
wataru-sakamoto:fix-issue-113

Conversation

@wataru-sakamoto

Copy link
Copy Markdown

Summary

Fix issue #113

・sigma/cli/main.py :54

Since there is no timeout set for requests.get(), it may hang.

Suggested fix

Before the fix

requests.get("https://pypi.org/pypi/sigma-cli/json")

After the fix

requests.get("https://pypi.org/pypi/sigma-cli/json", timeout=(3.05, 10))

Regarding timeout exception handling, since the original code catches all exceptions using a plain except statement, I haven't created any new exception handling logic.

The value of 3.05 for the connection timeout was based on the official documentation.
https://requests.readthedocs.io/en/latest/user/advanced/#timeouts

About the Test

Since the original code catches all exceptions using a plain except statement,
I don't think it's necessary to add any test code as part of this fix.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants