perf: 优化创建子节点时锁置后

pull/13668/head
halo 2024-07-02 22:20:32 +08:00 committed by Bryan
parent d70351e6b3
commit a78ccc9667
1 changed files with 9 additions and 9 deletions

View File

@ -39,7 +39,6 @@ class NodeChildrenApi(generics.ListCreateAPIView):
self.instance = self.get_object()
def perform_create(self, serializer):
with NodeAddChildrenLock(self.instance):
data = serializer.validated_data
_id = data.get("id")
value = data.get("value")
@ -49,6 +48,7 @@ class NodeChildrenApi(generics.ListCreateAPIView):
raise JMSException(_('The same level node name cannot be the same'))
else:
value = self.instance.get_next_child_preset_name()
with NodeAddChildrenLock(self.instance):
node = self.instance.create_child(value=value, _id=_id)
# 避免查询 full value
node._full_value = node.value