Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
push_notifications: Set more reasonable timeouts.
Tim Abbottd29d132e8ae1
diff --git a/zerver/lib/remote_server.py b/zerver/lib/remote_server.pyindex 9c14fe81d1f..7e5cf49c612 100644--- a/zerver/lib/remote_server.py+++ b/zerver/lib/remote_server.py@@ -20,8 +20,8 @@ from zerver.models import OrgTypeEnum, Realm, RealmAuditLogclass PushBouncerSession(OutgoingSession):- def __init__(self) -> None:- super().__init__(role="push_bouncer", timeout=30)+ def __init__(self, timeout: int = 15) -> None:+ super().__init__(role="push_bouncer", timeout=timeout)class PushNotificationBouncerError(Exception):@@ -98,9 +98,23 @@ def send_to_push_bouncer(headers = {"User-agent": f"ZulipServer/{ZULIP_VERSION}"}headers.update(extra_headers)+ if endpoint == "server/analytics":+ # Uploading audit log and/or analytics data can require the+ # bouncer to do a significant chunk of work in a few+ # situations; since this occurs in background jobs, set a long+ # timeout.+ session = PushBouncerSession(timeout=90)+ else:+ session = PushBouncerSession()+try:- res = PushBouncerSession().request(- method, url, data=post_data, auth=api_auth, verify=True, headers=headers+ res = session.request(+ method,+ url,+ data=post_data,+ auth=api_auth,+ verify=True,+ headers=headers,)except (requests.exceptions.Timeout,