mirror of https://github.com/zulip/zulip.git
scheduled_messages: Send event on commit in edit_scheduled_message.
Earlier, we were using 'send_event' in 'edit_scheduled_messages' which can lead to a situation, if any db operation is added after the 'send_event' in future, where we enqueue events but the action function fails at a later stage. Events should not be sent until we know we're not rolling back. Fixes part of #30489.
This commit is contained in:
parent
b0390ce1ee
commit
500fb3d804
|
@ -127,6 +127,7 @@ def notify_update_scheduled_message(
|
|||
send_event_on_commit(user_profile.realm, event, [user_profile.id])
|
||||
|
||||
|
||||
@transaction.atomic(durable=True)
|
||||
def edit_scheduled_message(
|
||||
sender: UserProfile,
|
||||
client: Client,
|
||||
|
@ -138,7 +139,6 @@ def edit_scheduled_message(
|
|||
deliver_at: datetime | None,
|
||||
realm: Realm,
|
||||
) -> None:
|
||||
with transaction.atomic():
|
||||
scheduled_message_object = access_scheduled_message(sender, scheduled_message_id)
|
||||
|
||||
# Handles the race between us initiating this transaction and user sending us the edit request.
|
||||
|
|
Loading…
Reference in New Issue