remote_server: Rename to 'send_server_data_to_push_bouncer'.

This commit renames 'send_analytics_to_push_bouncer'
to 'send_server_data_to_push_bouncer'.
This commit is contained in:
Prakhar Pratyush 2023-12-11 18:54:13 +05:30 committed by Tim Abbott
parent 41ceae9c31
commit c1daabd3c0
8 changed files with 48 additions and 48 deletions

View File

@ -13,7 +13,7 @@ from typing_extensions import override
from analytics.lib.counts import ALL_COUNT_STATS, logger, process_count_stat from analytics.lib.counts import ALL_COUNT_STATS, logger, process_count_stat
from scripts.lib.zulip_tools import ENDC, WARNING from scripts.lib.zulip_tools import ENDC, WARNING
from zerver.lib.remote_server import send_analytics_to_push_bouncer from zerver.lib.remote_server import send_server_data_to_push_bouncer
from zerver.lib.timestamp import floor_to_hour from zerver.lib.timestamp import floor_to_hour
from zerver.models import Realm from zerver.models import Realm
@ -106,4 +106,4 @@ class Command(BaseCommand):
logger.info("Sleeping %d seconds before reporting...", delay) logger.info("Sleeping %d seconds before reporting...", delay)
time.sleep(delay) time.sleep(delay)
send_analytics_to_push_bouncer(consider_usage_statistics=True) send_server_data_to_push_bouncer(consider_usage_statistics=True)

View File

@ -15,7 +15,7 @@ from corporate.lib.remote_billing_util import (
RemoteBillingIdentityDict, RemoteBillingIdentityDict,
RemoteBillingUserDict, RemoteBillingUserDict,
) )
from zerver.lib.remote_server import send_analytics_to_push_bouncer from zerver.lib.remote_server import send_server_data_to_push_bouncer
from zerver.lib.test_classes import BouncerTestCase from zerver.lib.test_classes import BouncerTestCase
from zerver.lib.timestamp import datetime_to_timestamp from zerver.lib.timestamp import datetime_to_timestamp
from zerver.models import UserProfile from zerver.models import UserProfile
@ -163,7 +163,7 @@ class RemoteBillingAuthenticationTest(BouncerTestCase):
realm = desdemona.realm realm = desdemona.realm
self.add_mock_response() self.add_mock_response()
send_analytics_to_push_bouncer(consider_usage_statistics=False) send_server_data_to_push_bouncer(consider_usage_statistics=False)
result = self.execute_remote_billing_authentication_flow(desdemona) result = self.execute_remote_billing_authentication_flow(desdemona)
@ -193,14 +193,14 @@ class RemoteBillingAuthenticationTest(BouncerTestCase):
# and successfully completing the flow - transparently to the user. # and successfully completing the flow - transparently to the user.
self.assertFalse(RemoteRealm.objects.filter(uuid=realm.uuid).exists()) self.assertFalse(RemoteRealm.objects.filter(uuid=realm.uuid).exists())
# send_analytics_to_push_bouncer will be called within the endpoint's # send_server_data_to_push_bouncer will be called within the endpoint's
# error handling to register realms with the bouncer. We mock.patch it # error handling to register realms with the bouncer. We mock.patch it
# to be able to assert that it was called - but also use side_effect # to be able to assert that it was called - but also use side_effect
# to maintain the original behavior of the function, instead of # to maintain the original behavior of the function, instead of
# replacing it with a Mock. # replacing it with a Mock.
with mock.patch( with mock.patch(
"zerver.views.push_notifications.send_analytics_to_push_bouncer", "zerver.views.push_notifications.send_server_data_to_push_bouncer",
side_effect=send_analytics_to_push_bouncer, side_effect=send_server_data_to_push_bouncer,
) as m: ) as m:
result = self.execute_remote_billing_authentication_flow(desdemona) result = self.execute_remote_billing_authentication_flow(desdemona)
@ -219,7 +219,7 @@ class RemoteBillingAuthenticationTest(BouncerTestCase):
desdemona = self.example_user("desdemona") desdemona = self.example_user("desdemona")
self.add_mock_response() self.add_mock_response()
send_analytics_to_push_bouncer(consider_usage_statistics=False) send_server_data_to_push_bouncer(consider_usage_statistics=False)
result = self.execute_remote_billing_authentication_flow( result = self.execute_remote_billing_authentication_flow(
desdemona, desdemona,
@ -235,7 +235,7 @@ class RemoteBillingAuthenticationTest(BouncerTestCase):
desdemona = self.example_user("desdemona") desdemona = self.example_user("desdemona")
self.add_mock_response() self.add_mock_response()
send_analytics_to_push_bouncer(consider_usage_statistics=False) send_server_data_to_push_bouncer(consider_usage_statistics=False)
with self.settings(TERMS_OF_SERVICE_VERSION="1.0"): with self.settings(TERMS_OF_SERVICE_VERSION="1.0"):
result = self.execute_remote_billing_authentication_flow( result = self.execute_remote_billing_authentication_flow(
@ -280,7 +280,7 @@ class RemoteBillingAuthenticationTest(BouncerTestCase):
realm = desdemona.realm realm = desdemona.realm
self.add_mock_response() self.add_mock_response()
send_analytics_to_push_bouncer(consider_usage_statistics=False) send_server_data_to_push_bouncer(consider_usage_statistics=False)
with time_machine.travel(now, tick=False): with time_machine.travel(now, tick=False):
result = self.execute_remote_billing_authentication_flow(desdemona) result = self.execute_remote_billing_authentication_flow(desdemona)
@ -336,7 +336,7 @@ class RemoteBillingAuthenticationTest(BouncerTestCase):
realm = desdemona.realm realm = desdemona.realm
self.add_mock_response() self.add_mock_response()
send_analytics_to_push_bouncer(consider_usage_statistics=False) send_server_data_to_push_bouncer(consider_usage_statistics=False)
# Straight-up access without authing at all: # Straight-up access without authing at all:
result = self.client_get(f"/realm/{realm.uuid!s}/plans/", subdomain="selfhosting") result = self.client_get(f"/realm/{realm.uuid!s}/plans/", subdomain="selfhosting")
@ -388,7 +388,7 @@ class RemoteBillingAuthenticationTest(BouncerTestCase):
realm = desdemona.realm realm = desdemona.realm
self.add_mock_response() self.add_mock_response()
send_analytics_to_push_bouncer(consider_usage_statistics=False) send_server_data_to_push_bouncer(consider_usage_statistics=False)
result = self.execute_remote_billing_authentication_flow(desdemona, "sponsorship") result = self.execute_remote_billing_authentication_flow(desdemona, "sponsorship")
@ -408,7 +408,7 @@ class RemoteBillingAuthenticationTest(BouncerTestCase):
realm = desdemona.realm realm = desdemona.realm
self.add_mock_response() self.add_mock_response()
send_analytics_to_push_bouncer(consider_usage_statistics=False) send_server_data_to_push_bouncer(consider_usage_statistics=False)
result = self.execute_remote_billing_authentication_flow(desdemona, "upgrade") result = self.execute_remote_billing_authentication_flow(desdemona, "upgrade")

View File

@ -44,8 +44,8 @@ from zerver.lib.exceptions import ErrorCode, JsonableError
from zerver.lib.message import access_message, huddle_users from zerver.lib.message import access_message, huddle_users
from zerver.lib.outgoing_http import OutgoingSession from zerver.lib.outgoing_http import OutgoingSession
from zerver.lib.remote_server import ( from zerver.lib.remote_server import (
send_analytics_to_push_bouncer,
send_json_to_push_bouncer, send_json_to_push_bouncer,
send_server_data_to_push_bouncer,
send_to_push_bouncer, send_to_push_bouncer,
) )
from zerver.lib.soft_deactivation import soft_reactivate_if_personal_notification from zerver.lib.soft_deactivation import soft_reactivate_if_personal_notification
@ -784,7 +784,7 @@ def initialize_push_notifications() -> None:
# If we're using the notification bouncer, check if we can # If we're using the notification bouncer, check if we can
# actually send push notifications, and update our # actually send push notifications, and update our
# understanding of that state for each realm accordingly. # understanding of that state for each realm accordingly.
send_analytics_to_push_bouncer(consider_usage_statistics=False) send_server_data_to_push_bouncer(consider_usage_statistics=False)
return return
logger.warning( # nocoverage logger.warning( # nocoverage

View File

@ -314,7 +314,7 @@ def get_realms_info_for_push_bouncer(realm_id: Optional[int] = None) -> List[Rea
return realm_info_list return realm_info_list
def send_analytics_to_push_bouncer(consider_usage_statistics: bool = True) -> None: def send_server_data_to_push_bouncer(consider_usage_statistics: bool = True) -> None:
logger = logging.getLogger("zulip.analytics") logger = logging.getLogger("zulip.analytics")
# first, check what's latest # first, check what's latest
try: try:

View File

@ -4856,7 +4856,7 @@ class AbstractRealmAuditLog(models.Model):
# This value is for RemoteRealmAuditLog entries tracking changes to the # This value is for RemoteRealmAuditLog entries tracking changes to the
# RemoteRealm model resulting from modified realm information sent to us # RemoteRealm model resulting from modified realm information sent to us
# via send_analytics_to_push_bouncer. # via send_server_data_to_push_bouncer.
REMOTE_REALM_VALUE_UPDATED = 20001 REMOTE_REALM_VALUE_UPDATED = 20001
REMOTE_PLAN_TRANSFERRED_SERVER_TO_REALM = 20002 REMOTE_PLAN_TRANSFERRED_SERVER_TO_REALM = 20002

View File

@ -66,7 +66,7 @@ from zerver.lib.remote_server import (
PushNotificationBouncerServerError, PushNotificationBouncerServerError,
build_analytics_data, build_analytics_data,
get_realms_info_for_push_bouncer, get_realms_info_for_push_bouncer,
send_analytics_to_push_bouncer, send_server_data_to_push_bouncer,
send_to_push_bouncer, send_to_push_bouncer,
) )
from zerver.lib.response import json_response_from_error from zerver.lib.response import json_response_from_error
@ -1033,7 +1033,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
"zulip.analytics", level="WARNING" "zulip.analytics", level="WARNING"
) as mock_warning: ) as mock_warning:
resp.add(responses.GET, ANALYTICS_STATUS_URL, body=ConnectionError()) resp.add(responses.GET, ANALYTICS_STATUS_URL, body=ConnectionError())
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
self.assertIn( self.assertIn(
"WARNING:zulip.analytics:ConnectionError while trying to connect to push notification bouncer\nTraceback ", "WARNING:zulip.analytics:ConnectionError while trying to connect to push notification bouncer\nTraceback ",
mock_warning.output[0], mock_warning.output[0],
@ -1046,7 +1046,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
assert remote_server is not None assert remote_server is not None
assert remote_server.last_version is None assert remote_server.last_version is None
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
self.assertTrue(responses.assert_call_count(ANALYTICS_STATUS_URL, 1)) self.assertTrue(responses.assert_call_count(ANALYTICS_STATUS_URL, 1))
audit_log = RealmAuditLog.objects.all().order_by("id").last() audit_log = RealmAuditLog.objects.all().order_by("id").last()
@ -1121,16 +1121,16 @@ class AnalyticsBouncerTest(BouncerTestCase):
with self.settings(SUBMIT_USAGE_STATISTICS=False): with self.settings(SUBMIT_USAGE_STATISTICS=False):
# With this setting off, we don't send RealmCounts and InstallationCounts. # With this setting off, we don't send RealmCounts and InstallationCounts.
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
check_counts(2, 2, 0, 0, 1) check_counts(2, 2, 0, 0, 1)
with self.settings(SUBMIT_USAGE_STATISTICS=True): with self.settings(SUBMIT_USAGE_STATISTICS=True):
# With 'SUBMIT_USAGE_STATISTICS=True' but 'consider_usage_statistics=False', # With 'SUBMIT_USAGE_STATISTICS=True' but 'consider_usage_statistics=False',
# we don't send RealmCount and InstallationCounts. # we don't send RealmCount and InstallationCounts.
send_analytics_to_push_bouncer(consider_usage_statistics=False) send_server_data_to_push_bouncer(consider_usage_statistics=False)
check_counts(3, 3, 0, 0, 1) check_counts(3, 3, 0, 0, 1)
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
check_counts(4, 4, 1, 1, 1) check_counts(4, 4, 1, 1, 1)
self.assertEqual( self.assertEqual(
@ -1207,7 +1207,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
# Deactivation is synced. # Deactivation is synced.
do_deactivate_realm(zephyr_realm, acting_user=None) do_deactivate_realm(zephyr_realm, acting_user=None)
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
check_counts(5, 5, 1, 1, 7) check_counts(5, 5, 1, 1, 7)
zephyr_remote_realm = RemoteRealm.objects.get(uuid=zephyr_realm.uuid) zephyr_remote_realm = RemoteRealm.objects.get(uuid=zephyr_realm.uuid)
@ -1285,7 +1285,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
) )
# Test having no new rows # Test having no new rows
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
check_counts(6, 6, 1, 1, 7) check_counts(6, 6, 1, 1, 7)
# Test only having new RealmCount rows # Test only having new RealmCount rows
@ -1301,14 +1301,14 @@ class AnalyticsBouncerTest(BouncerTestCase):
end_time=end_time + timedelta(days=2), end_time=end_time + timedelta(days=2),
value=9, value=9,
) )
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
check_counts(7, 7, 3, 1, 7) check_counts(7, 7, 3, 1, 7)
# Test only having new InstallationCount rows # Test only having new InstallationCount rows
InstallationCount.objects.create( InstallationCount.objects.create(
property=realm_stat.property, end_time=end_time + timedelta(days=1), value=6 property=realm_stat.property, end_time=end_time + timedelta(days=1), value=6
) )
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
check_counts(8, 8, 3, 2, 7) check_counts(8, 8, 3, 2, 7)
# Test only having new RealmAuditLog rows # Test only having new RealmAuditLog rows
@ -1320,7 +1320,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
event_time=end_time, event_time=end_time,
extra_data={"data": "foo"}, extra_data={"data": "foo"},
) )
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
check_counts(9, 9, 3, 2, 7) check_counts(9, 9, 3, 2, 7)
# Synced event # Synced event
RealmAuditLog.objects.create( RealmAuditLog.objects.create(
@ -1332,7 +1332,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
RealmAuditLog.ROLE_COUNT: realm_user_count_by_role(user.realm), RealmAuditLog.ROLE_COUNT: realm_user_count_by_role(user.realm),
}, },
) )
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
check_counts(10, 10, 3, 2, 8) check_counts(10, 10, 3, 2, 8)
# Now create an InstallationCount with a property that's not supposed # Now create an InstallationCount with a property that's not supposed
@ -1346,7 +1346,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
value=5, value=5,
) )
with self.assertLogs("zulip.analytics", level="WARNING") as warn_log: with self.assertLogs("zulip.analytics", level="WARNING") as warn_log:
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
self.assertEqual( self.assertEqual(
warn_log.output, warn_log.output,
["WARNING:zulip.analytics:Invalid property mobile_pushes_received::day"], ["WARNING:zulip.analytics:Invalid property mobile_pushes_received::day"],
@ -1382,7 +1382,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
id=F("id") + InstallationCount.objects.latest("id").id id=F("id") + InstallationCount.objects.latest("id").id
) )
with self.assertLogs(level="WARNING") as warn_log: with self.assertLogs(level="WARNING") as warn_log:
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
self.assertEqual( self.assertEqual(
warn_log.output, warn_log.output,
[ [
@ -1504,7 +1504,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
self.assertEqual(remote_realm_audit_log.remote_id, realm_audit_log.id) self.assertEqual(remote_realm_audit_log.remote_id, realm_audit_log.id)
self.assertEqual(remote_realm_audit_log.remote_realm, None) self.assertEqual(remote_realm_audit_log.remote_realm, None)
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
remote_realm_count.refresh_from_db() remote_realm_count.refresh_from_db()
remote_installation_count.refresh_from_db() remote_installation_count.refresh_from_db()
@ -1536,7 +1536,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
event_time=end_time, event_time=end_time,
extra_data={"data": "foo"}, extra_data={"data": "foo"},
) )
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
# Make sure new data was created, so that we're actually testing what we think. # Make sure new data was created, so that we're actually testing what we think.
self.assertEqual(RemoteRealmCount.objects.count(), current_remote_realm_count_amount + 1) self.assertEqual(RemoteRealmCount.objects.count(), current_remote_realm_count_amount + 1)
@ -1568,7 +1568,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
self.assertEqual(RemoteRealmCount.objects.count(), 0) self.assertEqual(RemoteRealmCount.objects.count(), 0)
with self.assertLogs("zulip.analytics", level="WARNING") as m: with self.assertLogs("zulip.analytics", level="WARNING") as m:
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
self.assertEqual(m.output, ["WARNING:zulip.analytics:Invalid property invalid count stat"]) self.assertEqual(m.output, ["WARNING:zulip.analytics:Invalid property invalid count stat"])
self.assertEqual(RemoteRealmCount.objects.count(), 0) self.assertEqual(RemoteRealmCount.objects.count(), 0)
@ -1610,7 +1610,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
with transaction.atomic(), self.assertLogs("zulip.analytics", level="WARNING") as m: with transaction.atomic(), self.assertLogs("zulip.analytics", level="WARNING") as m:
# The usual atomic() wrapper to avoid IntegrityError breaking the test's # The usual atomic() wrapper to avoid IntegrityError breaking the test's
# transaction. # transaction.
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
self.assertEqual(m.output, ["WARNING:zulip.analytics:Duplicate registration detected."]) self.assertEqual(m.output, ["WARNING:zulip.analytics:Duplicate registration detected."])
# Servers on Zulip 2.0.6 and earlier only send realm_counts and installation_counts data, # Servers on Zulip 2.0.6 and earlier only send realm_counts and installation_counts data,
@ -1661,7 +1661,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
extra_data=orjson.dumps({"foo": "bar"}).decode(), extra_data=orjson.dumps({"foo": "bar"}).decode(),
) )
# send_analytics_to_push_bouncer calls send_to_push_bouncer twice. # send_server_data_to_push_bouncer calls send_to_push_bouncer twice.
# We need to distinguish the first and second calls. # We need to distinguish the first and second calls.
first_call = True first_call = True
@ -1681,7 +1681,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
with mock.patch( with mock.patch(
"zerver.lib.remote_server.send_to_push_bouncer", side_effect=check_for_unwanted_data "zerver.lib.remote_server.send_to_push_bouncer", side_effect=check_for_unwanted_data
): ):
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
@override_settings(PUSH_NOTIFICATION_BOUNCER_URL="https://push.zulip.org.example.com") @override_settings(PUSH_NOTIFICATION_BOUNCER_URL="https://push.zulip.org.example.com")
@responses.activate @responses.activate
@ -1697,7 +1697,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
event_time=self.TIME_ZERO, event_time=self.TIME_ZERO,
extra_data=orjson.dumps({RealmAuditLog.ROLE_COUNT: user_count}).decode(), extra_data=orjson.dumps({RealmAuditLog.ROLE_COUNT: user_count}).decode(),
) )
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
remote_log_entry = RemoteRealmAuditLog.objects.order_by("id").last() remote_log_entry = RemoteRealmAuditLog.objects.order_by("id").last()
assert remote_log_entry is not None assert remote_log_entry is not None
self.assertEqual(str(remote_log_entry.server.uuid), self.server_uuid) self.assertEqual(str(remote_log_entry.server.uuid), self.server_uuid)
@ -1752,7 +1752,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
"zerver.lib.remote_server.send_to_push_bouncer", "zerver.lib.remote_server.send_to_push_bouncer",
side_effect=transform_realmauditlog_extra_data, side_effect=transform_realmauditlog_extra_data,
): ):
send_analytics_to_push_bouncer() send_server_data_to_push_bouncer()
if skip_audit_log_check: if skip_audit_log_check:
return return
@ -1795,7 +1795,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
with mock.patch( with mock.patch(
"zilencer.views.RemoteRealmBillingSession.get_customer", return_value=None "zilencer.views.RemoteRealmBillingSession.get_customer", return_value=None
) as m: ) as m:
send_analytics_to_push_bouncer(consider_usage_statistics=False) send_server_data_to_push_bouncer(consider_usage_statistics=False)
m.assert_called() m.assert_called()
realms = Realm.objects.all() realms = Realm.objects.all()
for realm in realms: for realm in realms:
@ -1807,7 +1807,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
"zilencer.views.RemoteRealmBillingSession.get_customer", return_value=dummy_customer "zilencer.views.RemoteRealmBillingSession.get_customer", return_value=dummy_customer
): ):
with mock.patch("zilencer.views.get_current_plan_by_customer", return_value=None) as m: with mock.patch("zilencer.views.get_current_plan_by_customer", return_value=None) as m:
send_analytics_to_push_bouncer(consider_usage_statistics=False) send_server_data_to_push_bouncer(consider_usage_statistics=False)
m.assert_called() m.assert_called()
realms = Realm.objects.all() realms = Realm.objects.all()
for realm in realms: for realm in realms:
@ -1827,7 +1827,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
"zilencer.views.RemoteRealmBillingSession.get_next_billing_cycle", "zilencer.views.RemoteRealmBillingSession.get_next_billing_cycle",
return_value=dummy_date, return_value=dummy_date,
) as m, self.assertLogs("zulip.analytics", level="INFO") as info_log: ) as m, self.assertLogs("zulip.analytics", level="INFO") as info_log:
send_analytics_to_push_bouncer(consider_usage_statistics=False) send_server_data_to_push_bouncer(consider_usage_statistics=False)
m.assert_called() m.assert_called()
realms = Realm.objects.all() realms = Realm.objects.all()
for realm in realms: for realm in realms:
@ -1857,7 +1857,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
m.side_effect = mock_send_to_push_bouncer_response m.side_effect = mock_send_to_push_bouncer_response
send_analytics_to_push_bouncer(consider_usage_statistics=False) send_server_data_to_push_bouncer(consider_usage_statistics=False)
realms = Realm.objects.all() realms = Realm.objects.all()
for realm in realms: for realm in realms:
@ -1867,7 +1867,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
exception_log.output[0], exception_log.output[0],
) )
send_analytics_to_push_bouncer(consider_usage_statistics=False) send_server_data_to_push_bouncer(consider_usage_statistics=False)
self.assertEqual( self.assertEqual(
list( list(

View File

@ -24,7 +24,7 @@ from zerver.lib.push_notifications import (
from zerver.lib.remote_server import ( from zerver.lib.remote_server import (
UserDataForRemoteBilling, UserDataForRemoteBilling,
get_realms_info_for_push_bouncer, get_realms_info_for_push_bouncer,
send_analytics_to_push_bouncer, send_server_data_to_push_bouncer,
send_to_push_bouncer, send_to_push_bouncer,
) )
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
@ -162,7 +162,7 @@ def self_hosting_auth_redirect(
result = send_to_push_bouncer("POST", "server/billing", post_data) result = send_to_push_bouncer("POST", "server/billing", post_data)
except MissingRemoteRealmError: except MissingRemoteRealmError:
# Upload realm info and re-try. It should work now. # Upload realm info and re-try. It should work now.
send_analytics_to_push_bouncer(consider_usage_statistics=False) send_server_data_to_push_bouncer(consider_usage_statistics=False)
result = send_to_push_bouncer("POST", "server/billing", post_data) result = send_to_push_bouncer("POST", "server/billing", post_data)
except RemoteRealmServerMismatchError: except RemoteRealmServerMismatchError:
return render(request, "zilencer/remote_realm_server_mismatch_error.html", status=403) return render(request, "zilencer/remote_realm_server_mismatch_error.html", status=403)

View File

@ -80,7 +80,7 @@ from zerver.lib.pysa import mark_sanitized
from zerver.lib.queue import SimpleQueueClient, retry_event from zerver.lib.queue import SimpleQueueClient, retry_event
from zerver.lib.remote_server import ( from zerver.lib.remote_server import (
PushNotificationBouncerRetryLaterError, PushNotificationBouncerRetryLaterError,
send_analytics_to_push_bouncer, send_server_data_to_push_bouncer,
) )
from zerver.lib.send_email import ( from zerver.lib.send_email import (
EmailNotDeliveredError, EmailNotDeliveredError,
@ -1174,7 +1174,7 @@ class DeferredWorker(QueueProcessingWorker):
# In the future we may use the realm_id to send only that single realm's info. # In the future we may use the realm_id to send only that single realm's info.
realm_id = event["realm_id"] realm_id = event["realm_id"]
logger.info("Updating push bouncer with metadata on behalf of 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) send_server_data_to_push_bouncer(consider_usage_statistics=False)
end = time.time() end = time.time()
logger.info( logger.info(