mirror of https://github.com/zulip/zulip.git
streams: Make db operations in do_change_subscription_property atomic.
This commit adds a transaction.atomic decorator to the 'do_change_subscription_property' function to make the db operations in the action function atomic. Also, send_event is changed to send_event_on_commit.
This commit is contained in:
parent
5d0b3d1a6d
commit
41d947b89d
|
@ -1099,6 +1099,7 @@ def bulk_remove_subscriptions(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@transaction.atomic(durable=True)
|
||||||
def do_change_subscription_property(
|
def do_change_subscription_property(
|
||||||
user_profile: UserProfile,
|
user_profile: UserProfile,
|
||||||
sub: Subscription,
|
sub: Subscription,
|
||||||
|
@ -1149,7 +1150,7 @@ def do_change_subscription_property(
|
||||||
stream_id=stream.id,
|
stream_id=stream.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
send_event(user_profile.realm, in_home_view_event, [user_profile.id])
|
send_event_on_commit(user_profile.realm, in_home_view_event, [user_profile.id])
|
||||||
|
|
||||||
event = dict(
|
event = dict(
|
||||||
type="subscription",
|
type="subscription",
|
||||||
|
@ -1158,7 +1159,7 @@ def do_change_subscription_property(
|
||||||
value=database_value,
|
value=database_value,
|
||||||
stream_id=stream.id,
|
stream_id=stream.id,
|
||||||
)
|
)
|
||||||
send_event(user_profile.realm, event, [user_profile.id])
|
send_event_on_commit(user_profile.realm, event, [user_profile.id])
|
||||||
|
|
||||||
|
|
||||||
def send_change_stream_permission_notification(
|
def send_change_stream_permission_notification(
|
||||||
|
|
Loading…
Reference in New Issue