push_notification: Use durable=True for the outermost transaction.

This commit updates the `transaction.atomic` context manager
used to take a lock on Message row in `handle_push_notification`
to use `durable=True` instead of `savepoint=False`. It helps to
avoid introducing an outer transaction by mistake - resulting in
locking row for a longer duration.

Signed-off-by: Prakhar Pratyush <prakhar@zulip.com>
This commit is contained in:
Prakhar Pratyush
2025-10-06 14:44:36 +05:30
committed by Tim Abbott
parent d6ce1c92b7
commit 140e575ddc

View File

@@ -1639,7 +1639,7 @@ def handle_push_notification(user_profile_id: int, missed_message: dict[str, Any
# BUG: Investigate why it's possible to get here.
return # nocoverage
with transaction.atomic(savepoint=False):
with transaction.atomic(durable=True):
try:
(message, user_message) = access_message_and_usermessage(
user_profile,