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

Add timeout at notify_ifttt #839

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

r1235613
Copy link
Contributor

Add a timeout setting.
In the current program, if there is a problem with the connection, it can cause the program to hang for a long time.

Signed-off-by: r1235613 <r1235613@gmail.com>
try:
requests.post(settings.get('ifttt_webhook_url'), data={'value1': title, 'value2': body}, timeout=10)
except requests.exceptions.Timeout:
logging.error(f"Connecting to IFTTT timeout.(Default is 10 sec)")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timeout doesn't necessarily mean Connection timeout as request doc mentions it catches both
requests.exceptions.ConnectTimeout , requests.exceptions.ReadTimeout errors.

except requests.exceptions.Timeout:
logging.error(f"Connecting to IFTTT timeout.(Default is 10 sec)")
except requests.exceptions.RequestException as e:
logging.error(f"Fail to connect IFTTT-{str(e)}")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also misleadning. this can be anything, failed to connect is only 1 case of many.

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.

None yet

2 participants