mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
Django 1.8 compatibility: transactions
- autocommit is now the default - commit_on_success is now atomic (imported from commit b6166ca666ff23d34f2871ca365ce3ec66b0fa86)
This commit is contained in:
@@ -463,7 +463,7 @@ def do_send_messages(messages):
|
||||
|
||||
# Save the message receipts in the database
|
||||
user_message_flags = defaultdict(dict)
|
||||
with transaction.commit_on_success():
|
||||
with transaction.atomic():
|
||||
Message.objects.bulk_create([message['message'] for message in messages])
|
||||
ums = []
|
||||
for message in messages:
|
||||
|
||||
@@ -1109,7 +1109,7 @@ def get_huddle(id_list):
|
||||
def get_huddle_backend(huddle_hash, id_list):
|
||||
(huddle, created) = Huddle.objects.get_or_create(huddle_hash=huddle_hash)
|
||||
if created:
|
||||
with transaction.commit_on_success():
|
||||
with transaction.atomic():
|
||||
recipient = Recipient.objects.create(type_id=huddle.id,
|
||||
type=Recipient.HUDDLE)
|
||||
subs_to_create = [Subscription(recipient=recipient,
|
||||
|
||||
@@ -1356,7 +1356,7 @@ def update_stream_backend(request, user_profile, stream_name,
|
||||
def list_subscriptions_backend(request, user_profile):
|
||||
return json_success({"subscriptions": gather_subscriptions(user_profile)[0]})
|
||||
|
||||
@transaction.commit_on_success
|
||||
@transaction.atomic
|
||||
@has_request_variables
|
||||
def update_subscriptions_backend(request, user_profile,
|
||||
delete=REQ(validator=check_list(check_string), default=[]),
|
||||
|
||||
@@ -197,7 +197,6 @@ DATABASES = {"default": {
|
||||
'CONN_MAX_AGE': 600,
|
||||
'OPTIONS': {
|
||||
'sslmode': 'verify-full',
|
||||
'autocommit': True,
|
||||
'connection_factory': TimeTrackingConnection
|
||||
},
|
||||
},
|
||||
@@ -208,7 +207,6 @@ if ENTERPRISE:
|
||||
# Host = '' => connect through a local socket
|
||||
'HOST': '',
|
||||
'OPTIONS': {
|
||||
'autocommit': True,
|
||||
'connection_factory': TimeTrackingConnection
|
||||
}
|
||||
})
|
||||
@@ -218,7 +216,6 @@ elif not DEPLOYED:
|
||||
'PASSWORD': LOCAL_DATABASE_PASSWORD,
|
||||
'HOST': 'localhost',
|
||||
'OPTIONS': {
|
||||
'autocommit': True,
|
||||
'connection_factory': TimeTrackingConnection
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user