diff --git a/zerver/lib/retention.py b/zerver/lib/retention.py index f18554811a..694f8318a8 100644 --- a/zerver/lib/retention.py +++ b/zerver/lib/retention.py @@ -141,7 +141,7 @@ def run_archiving( message_count = 0 while True: start_time = time.time() - with transaction.atomic(): + with transaction.atomic(savepoint=False): archive_transaction = ArchiveTransaction.objects.create(type=type, realm=realm) new_chunk = move_rows( Message, @@ -396,6 +396,7 @@ def archive_stream_messages( logger.info("Done. Archived %s messages.", message_count) +@transaction.atomic(durable=True) def archive_messages(chunk_size: int = MESSAGE_BATCH_SIZE) -> None: logger.info("Starting the archiving process with chunk_size %s", chunk_size) diff --git a/zerver/views/message_edit.py b/zerver/views/message_edit.py index 838d40ff2b..18a43615f4 100644 --- a/zerver/views/message_edit.py +++ b/zerver/views/message_edit.py @@ -167,7 +167,7 @@ def validate_can_delete_message(user_profile: UserProfile, message: Message) -> return -@transaction.atomic +@transaction.atomic(durable=True) @typed_endpoint def delete_message_backend( request: HttpRequest,