mirror of https://github.com/OCA/social.git
[FIX] mail_tracking_mailgun: Avoid infinite hangout registering hooks
We should put a timeout for isolated environments where there are no external connection. https://docs.python-requests.org/en/latest/user/quickstart/#timeoutspull/473/head
parent
897bd6e344
commit
4768925727
|
@ -6,7 +6,7 @@
|
|||
{
|
||||
"name": "Mail tracking for Mailgun",
|
||||
"summary": "Mail tracking and Mailgun webhooks integration",
|
||||
"version": "13.0.2.0.0",
|
||||
"version": "13.0.2.0.1",
|
||||
"category": "Social Network",
|
||||
"website": "https://github.com/OCA/social",
|
||||
"author": "Tecnativa, Odoo Community Association (OCA)",
|
||||
|
|
|
@ -82,6 +82,7 @@ class ResConfigSettings(models.TransientModel):
|
|||
webhooks = requests.get(
|
||||
urljoin(params.api_url, "/v3/domains/%s/webhooks" % params.domain),
|
||||
auth=("api", params.api_key),
|
||||
timeout=10,
|
||||
)
|
||||
webhooks.raise_for_status()
|
||||
for event, data in webhooks.json()["webhooks"].items():
|
||||
|
@ -100,6 +101,7 @@ class ResConfigSettings(models.TransientModel):
|
|||
"/v3/domains/%s/webhooks/%s" % (params.domain, event),
|
||||
),
|
||||
auth=("api", params.api_key),
|
||||
timeout=10,
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
|
@ -116,6 +118,7 @@ class ResConfigSettings(models.TransientModel):
|
|||
urljoin(params.api_url, "/v3/domains/%s/webhooks" % params.domain),
|
||||
auth=("api", params.api_key),
|
||||
data={"id": event, "url": [odoo_webhook]},
|
||||
timeout=10,
|
||||
)
|
||||
# Assert correct registration
|
||||
response.raise_for_status()
|
||||
|
|
Loading…
Reference in New Issue