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.

remote_server: Rename register_realm_with_push_bouncer.

Tim Abbott5c1a5a816fec
diff --git a/zerver/lib/remote_server.py b/zerver/lib/remote_server.py
index b826cbd21cf..32e57f526f0 100644
--- a/zerver/lib/remote_server.py
+++ b/zerver/lib/remote_server.py
@@ -404,11 +404,14 @@ def send_analytics_to_push_bouncer(consider_usage_statistics: bool = True) -> No
def maybe_enqueue_audit_log_upload(realm: Realm) -> None:
+ # Update the push notifications service, either with the fact that
+ # the realm now exists or updates to its audit log of users.
+ #
+ # Done via a queue worker so that networking failures cannot have
+ # any impact on the success operation of the local server's
+ # ability to do operations that trigger these updates.
from zerver.lib.push_notifications import uses_notification_bouncer
if uses_notification_bouncer():
- # Let the bouncer know about the new realm.
- # We do this in a queue worker to avoid messing with the realm
- # creation process due to network issues or latency.
- event = {"type": "register_realm_with_push_bouncer", "realm_id": realm.id}
+ event = {"type": "push_bouncer_update_for_realm", "realm_id": realm.id}
queue_event_on_commit("deferred_work", event)
diff --git a/zerver/worker/queue_processors.py b/zerver/worker/queue_processors.py
index dd7669b9a93..1fe0e3776c6 100644
--- a/zerver/worker/queue_processors.py
+++ b/zerver/worker/queue_processors.py
@@ -1170,12 +1170,10 @@ class DeferredWorker(QueueProcessingWorker):
)
user_profile = get_user_profile_by_id(event["user_profile_id"])
reactivate_user_if_soft_deactivated(user_profile)
- elif event["type"] == "register_realm_with_push_bouncer":
+ elif event["type"] == "push_bouncer_update_for_realm":
# In the future we may use the realm_id to send only that single realm's info.
realm_id = event["realm_id"]
- logger.info(
- "Running send_analytics_to_push_bouncer, requested due to realm %s", realm_id
- )
+ logger.info("Updating push bouncer with metadata on behalf of realm %s", realm_id)
send_analytics_to_push_bouncer(consider_usage_statistics=False)
end = time.time()