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.

migrations: Only open a transaction if we will use it.

Alex Vandiver0e825373f67f
diff --git a/zerver/migrations/0756_handle_same_anonymous_group_used_for_multiple_streams.py b/zerver/migrations/0756_handle_same_anonymous_group_used_for_multiple_streams.py
index 14f6df2672c..7f794b48dee 100644
--- a/zerver/migrations/0756_handle_same_anonymous_group_used_for_multiple_streams.py
+++ b/zerver/migrations/0756_handle_same_anonymous_group_used_for_multiple_streams.py
@@ -115,8 +115,8 @@ def handle_same_anonymous_group_used_for_multiple_streams(
if stream_updated:
streams_to_update.append(stream)
- with transaction.atomic():
- if streams_to_update:
+ if streams_to_update:
+ with transaction.atomic():
UserGroup.objects.bulk_create(user_groups_to_create)
Stream.objects.bulk_update(streams_to_update, fields=updated_fields)
UserGroupMembership.objects.bulk_create(user_group_memberships_to_create)