mirror of
https://github.com/suitenumerique/docs.git
synced 2026-09-23 18:15:10 +02:00
🐛(backend) stop using add_sibling method to create sandbox document
In a past release we added a feature to create a sandbox document to a newly created used. To create this sandbox document, we duplicate an existing document and this duplicate is using the add_sibling method with the "right" agument on this original document. Adding a sibling at the right to a document involve moving right every root document created after the original document, so the path of all this documents are recalculated and changed. This can lead to the lost of some leaf in a tree because to do this operation, multiple locks are created on the database, creating lot of connection to the database and if the max number connection to the database is reached or if the memory allocated by the database is too hight, the database can close all connections leading to inconsistent paths in the Document table.
This commit is contained in:
@@ -285,8 +285,7 @@ class User(AbstractBaseUser, BaseModel, auth_models.PermissionsMixin):
|
||||
)
|
||||
return
|
||||
|
||||
sandbox_document = template_document.add_sibling(
|
||||
"right",
|
||||
sandbox_document = Document.add_root(
|
||||
title=template_document.title,
|
||||
content=template_document.content,
|
||||
attachments=template_document.attachments,
|
||||
|
||||
Reference in New Issue
Block a user