mirror of
https://github.com/zulip/zulip.git
synced 2025-10-28 18:43:52 +00:00
message_send: Update do_send_messages codepath to send event on commit.
Earlier, we were using 'send_event' & 'queue_json_publish' in 'do_send_messages' which can lead to a situation where we enqueue events but the transaction fails at a later stage. Events should not be sent until we know we're not rolling back.
This commit is contained in:
committed by
Tim Abbott
parent
27c4e46b30
commit
c798d192dc
@@ -341,16 +341,17 @@ class GetEventsTest(ZulipTestCase):
|
||||
self.assert_length(events, 0)
|
||||
|
||||
local_id = "10.01"
|
||||
check_send_message(
|
||||
sender=user_profile,
|
||||
client=get_client("whatever"),
|
||||
recipient_type_name="private",
|
||||
message_to=[recipient_email],
|
||||
topic_name=None,
|
||||
message_content="hello",
|
||||
local_id=local_id,
|
||||
sender_queue_id=queue_id,
|
||||
)
|
||||
with self.captureOnCommitCallbacks(execute=True):
|
||||
check_send_message(
|
||||
sender=user_profile,
|
||||
client=get_client("whatever"),
|
||||
recipient_type_name="private",
|
||||
message_to=[recipient_email],
|
||||
topic_name=None,
|
||||
message_content="hello",
|
||||
local_id=local_id,
|
||||
sender_queue_id=queue_id,
|
||||
)
|
||||
|
||||
result = self.tornado_call(
|
||||
get_events,
|
||||
@@ -374,16 +375,17 @@ class GetEventsTest(ZulipTestCase):
|
||||
last_event_id = events[0]["id"]
|
||||
local_id = "10.02"
|
||||
|
||||
check_send_message(
|
||||
sender=user_profile,
|
||||
client=get_client("whatever"),
|
||||
recipient_type_name="private",
|
||||
message_to=[recipient_email],
|
||||
topic_name=None,
|
||||
message_content="hello",
|
||||
local_id=local_id,
|
||||
sender_queue_id=queue_id,
|
||||
)
|
||||
with self.captureOnCommitCallbacks(execute=True):
|
||||
check_send_message(
|
||||
sender=user_profile,
|
||||
client=get_client("whatever"),
|
||||
recipient_type_name="private",
|
||||
message_to=[recipient_email],
|
||||
topic_name=None,
|
||||
message_content="hello",
|
||||
local_id=local_id,
|
||||
sender_queue_id=queue_id,
|
||||
)
|
||||
|
||||
result = self.tornado_call(
|
||||
get_events,
|
||||
|
||||
Reference in New Issue
Block a user