Add timeout to any outbound connection (#1756)

* Add timeout to any outbound connection

* Change log message to error

---------

Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
This commit is contained in:
Adrià Casajús 2023-05-31 14:19:43 +02:00 committed by GitHub
parent d30183bbda
commit 85964f283e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@ def execute_subscription_webhook(user: User):
"active_subscription_end": sl_subscription_end,
}
try:
response = requests.post(webhook_url, json=payload)
response = requests.post(webhook_url, json=payload, timeout=2)
if response.status_code == 200:
LOG.i("Sent request to subscription update webhook successfully")
else:
@ -30,4 +30,4 @@ def execute_subscription_webhook(user: User):
f"Request to webhook failed with statue {response.status_code}: {response.text}"
)
except RequestException as e:
LOG.warn(f"Subscription request exception: {e}")
LOG.error(f"Subscription request exception: {e}")