Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

push_notifications: Drop FCM retries to 2, not 10.

Alex Vandiverf531f3a27fc9
diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.py
index 9c0f8628a88..12c0cb44bd0 100644
--- a/zerver/lib/push_notifications.py
+++ b/zerver/lib/push_notifications.py
@@ -343,7 +343,10 @@ def send_android_push_notification(
# Two kwargs `retries` and `session` get eaten by `json_request`;
# the rest pass through to the GCM server.
res = gcm_client.json_request(
- registration_ids=reg_ids, priority=priority, data=data, retries=10
+ registration_ids=reg_ids,
+ priority=priority,
+ data=data,
+ retries=2,
)
except OSError:
logger.warning("Error while pushing to GCM", exc_info=True)
diff --git a/zilencer/views.py b/zilencer/views.py
index e0859e1d979..c48b538fcb9 100644
--- a/zilencer/views.py
+++ b/zilencer/views.py
@@ -257,6 +257,12 @@ def remote_server_notify_push(
payload["zulip_message_ids"] = ",".join(str(id) for id in truncated_ids)
return payload
+ # The full request must complete within 30s, the timeout set by
+ # Zulip remote hosts for push notification requests (see
+ # PushBouncerSession). The timeouts in the FCM and APNS codepaths
+ # must be set accordingly; see send_android_push_notification and
+ # send_apple_push_notification.
+
gcm_payload = truncate_payload(gcm_payload)
send_android_push_notification(
user_id, android_devices, gcm_payload, gcm_options, remote=server