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:
parent
d30183bbda
commit
85964f283e
|
@ -22,7 +22,7 @@ def execute_subscription_webhook(user: User):
|
||||||
"active_subscription_end": sl_subscription_end,
|
"active_subscription_end": sl_subscription_end,
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
response = requests.post(webhook_url, json=payload)
|
response = requests.post(webhook_url, json=payload, timeout=2)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
LOG.i("Sent request to subscription update webhook successfully")
|
LOG.i("Sent request to subscription update webhook successfully")
|
||||||
else:
|
else:
|
||||||
|
@ -30,4 +30,4 @@ def execute_subscription_webhook(user: User):
|
||||||
f"Request to webhook failed with statue {response.status_code}: {response.text}"
|
f"Request to webhook failed with statue {response.status_code}: {response.text}"
|
||||||
)
|
)
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
LOG.warn(f"Subscription request exception: {e}")
|
LOG.error(f"Subscription request exception: {e}")
|
||||||
|
|
Loading…
Reference in New Issue