mirror of https://github.com/zulip/zulip.git
remote_server: Rename register_realm_with_push_bouncer.
We plan to have this potentially happen more than once for a given realm.
This commit is contained in:
parent
4fe02be825
commit
5c1a5a816f
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue