🔥(backend) remove usage of atomic transaction for item creation

We used atomic transaction in the ItemViewset when a new item is created
(perform_create and children actions). This code can be removed seen we
decided to use UUID for the item path. The race condition possible when
multiple items are created does not exists anymore, we don't need to
know previously created item to guess the next path.
This commit is contained in:
Manuel Raynaud
2026-01-28 08:05:13 +01:00
parent ca6cbacff3
commit 5e16aa9dcc
2 changed files with 9 additions and 7 deletions
+4
View File
@@ -12,6 +12,10 @@ and this project adheres to
- 🏗️ (ds_proxy) introduce how to use ds_proxy with Drive
### Changed
- 🔥(backend) remove usage of atomic transaction for item creation
## [v0.11.1] - 2026-01-13
### Fixed
+5 -7
View File
@@ -572,7 +572,6 @@ class ItemViewSet(
return drf.response.Response(serializer.data)
@transaction.atomic
def perform_create(self, serializer):
"""Set the current user as creator and owner of the newly created object."""
obj = models.Item.objects.create_child(
@@ -911,12 +910,11 @@ class ItemViewSet(
)
)
with transaction.atomic():
child_item = models.Item.objects.create_child(
creator=request.user,
parent=item,
**serializer.validated_data,
)
child_item = models.Item.objects.create_child(
creator=request.user,
parent=item,
**serializer.validated_data,
)
# Set the created instance to the serializer
serializer.instance = child_item