mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
django_api: Rename 'send_event' to 'send_event_rollback_unsafe'.
This commit renames the 'send_event' function to 'send_event_rollback_unsafe' to reflect the fact that it doesn't wait for the db transaction (within which it gets called, if any) to commit and sends event irrespective of commit or rollback. In most of the cases we don't want to send event in the case of rollbacks, so the caller should be aware that calling the function directly is rollback unsafe.
This commit is contained in:
committed by
Tim Abbott
parent
8e71806958
commit
e763d065a3
@@ -5,7 +5,7 @@ from zerver.lib.exceptions import JsonableError
|
||||
from zerver.lib.stream_subscription import get_active_subscriptions_for_stream_id
|
||||
from zerver.models import Realm, Stream, UserProfile
|
||||
from zerver.models.users import get_user_by_id_in_realm_including_cross_realm
|
||||
from zerver.tornado.django_api import send_event
|
||||
from zerver.tornado.django_api import send_event_rollback_unsafe
|
||||
|
||||
|
||||
def do_send_typing_notification(
|
||||
@@ -32,7 +32,7 @@ def do_send_typing_notification(
|
||||
if user.is_active and user.receives_typing_notifications
|
||||
]
|
||||
|
||||
send_event(realm, event, user_ids_to_notify)
|
||||
send_event_rollback_unsafe(realm, event, user_ids_to_notify)
|
||||
|
||||
|
||||
# check_send_typing_notification:
|
||||
@@ -98,4 +98,4 @@ def do_send_stream_typing_notification(
|
||||
.values_list("user_profile_id", flat=True)
|
||||
)
|
||||
|
||||
send_event(sender.realm, event, user_ids_to_notify)
|
||||
send_event_rollback_unsafe(sender.realm, event, user_ids_to_notify)
|
||||
|
Reference in New Issue
Block a user