mirror of https://github.com/zulip/zulip.git
actions: Use 'durable=True' in outermost transaction.atomic block.
We used 'savepoint=False' in #31169 which was prior to our discussion in CZO to use 'durable=True' instead. This commit makes changes to use 'durable=True' in the outermost transaction.atomic block.
This commit is contained in:
parent
d7761f7163
commit
a2ff4f52c4
|
@ -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])
|
send_event_on_commit(user_profile.realm, event, [user_profile.id])
|
||||||
|
|
||||||
|
|
||||||
@transaction.atomic(savepoint=False)
|
@transaction.atomic(durable=True)
|
||||||
def do_add_alert_words(user_profile: UserProfile, alert_words: Iterable[str]) -> None:
|
def do_add_alert_words(user_profile: UserProfile, alert_words: Iterable[str]) -> None:
|
||||||
words = add_user_alert_words(user_profile, alert_words)
|
words = add_user_alert_words(user_profile, alert_words)
|
||||||
notify_alert_words(user_profile, words)
|
notify_alert_words(user_profile, words)
|
||||||
|
|
||||||
|
|
||||||
@transaction.atomic(savepoint=False)
|
@transaction.atomic(durable=True)
|
||||||
def do_remove_alert_words(user_profile: UserProfile, alert_words: Iterable[str]) -> None:
|
def do_remove_alert_words(user_profile: UserProfile, alert_words: Iterable[str]) -> None:
|
||||||
words = remove_user_alert_words(user_profile, alert_words)
|
words = remove_user_alert_words(user_profile, alert_words)
|
||||||
notify_alert_words(user_profile, words)
|
notify_alert_words(user_profile, words)
|
||||||
|
|
|
@ -93,7 +93,7 @@ def do_schedule_messages(
|
||||||
|
|
||||||
scheduled_messages.append((scheduled_message, send_request))
|
scheduled_messages.append((scheduled_message, send_request))
|
||||||
|
|
||||||
with transaction.atomic():
|
with transaction.atomic(durable=True):
|
||||||
ScheduledMessage.objects.bulk_create(
|
ScheduledMessage.objects.bulk_create(
|
||||||
[scheduled_message for scheduled_message, ignored in scheduled_messages]
|
[scheduled_message for scheduled_message, ignored in scheduled_messages]
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,7 +7,7 @@ from zerver.models import UserProfile
|
||||||
from zerver.tornado.django_api import send_event_on_commit
|
from zerver.tornado.django_api import send_event_on_commit
|
||||||
|
|
||||||
|
|
||||||
@transaction.atomic(savepoint=False)
|
@transaction.atomic(durable=True)
|
||||||
def do_update_user_status(
|
def do_update_user_status(
|
||||||
user_profile: UserProfile,
|
user_profile: UserProfile,
|
||||||
away: bool | None,
|
away: bool | None,
|
||||||
|
|
Loading…
Reference in New Issue