Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

actions: Use 'durable=True' in outermost transaction.atomic block.

Prakhar Pratyusha2ff4f52c4aa
diff --git a/zerver/actions/alert_words.py b/zerver/actions/alert_words.py
index 4a0430ae819..b88ab5df971 100644
--- a/zerver/actions/alert_words.py
+++ b/zerver/actions/alert_words.py
@@ -12,13 +12,13 @@ def notify_alert_words(user_profile: UserProfile, words: Sequence[str]) -> None:
send_event_on_commit(user_profile.realm, event, [user_profile.id])
[email protected](savepoint=False)
[email protected](durable=True)
def do_add_alert_words(user_profile: UserProfile, alert_words: Iterable[str]) -> None:
words = add_user_alert_words(user_profile, alert_words)
notify_alert_words(user_profile, words)
[email protected](savepoint=False)
[email protected](durable=True)
def do_remove_alert_words(user_profile: UserProfile, alert_words: Iterable[str]) -> None:
words = remove_user_alert_words(user_profile, alert_words)
notify_alert_words(user_profile, words)
diff --git a/zerver/actions/scheduled_messages.py b/zerver/actions/scheduled_messages.py
index 3729b532ef2..d4f32b1cfcf 100644
--- a/zerver/actions/scheduled_messages.py
+++ b/zerver/actions/scheduled_messages.py
@@ -93,7 +93,7 @@ def do_schedule_messages(
scheduled_messages.append((scheduled_message, send_request))
- with transaction.atomic():
+ with transaction.atomic(durable=True):
ScheduledMessage.objects.bulk_create(
[scheduled_message for scheduled_message, ignored in scheduled_messages]
)
diff --git a/zerver/actions/user_status.py b/zerver/actions/user_status.py
index cf6f2708a11..ede31abcd71 100644
--- a/zerver/actions/user_status.py
+++ b/zerver/actions/user_status.py
@@ -7,7 +7,7 @@ from zerver.models import UserProfile
from zerver.tornado.django_api import send_event_on_commit
[email protected](savepoint=False)
[email protected](durable=True)
def do_update_user_status(
user_profile: UserProfile,
away: bool | None,