feat: base 移除基础model层事务

This commit is contained in:
caoqianming 2025-09-16 10:33:44 +08:00
parent 7a82844842
commit f151f4f2ec
1 changed files with 33 additions and 34 deletions

View File

@ -119,7 +119,6 @@ class BaseModel(models.Model):
for attempt in range(3):
try:
with transaction.atomic():
# 先尝试获取(带锁)
try:
obj = cls.objects.select_for_update().get(**kwargs)
@ -148,7 +147,7 @@ class BaseModel(models.Model):
if not self.id:
is_create = True
self.id = idWorker.get_id()
with transaction.atomic():
old_parent = None
need_handle_parent = False
if hasattr(self, "parent"):