feat: base 移除基础model层事务
This commit is contained in:
parent
7a82844842
commit
f151f4f2ec
|
@ -119,7 +119,6 @@ class BaseModel(models.Model):
|
||||||
|
|
||||||
for attempt in range(3):
|
for attempt in range(3):
|
||||||
try:
|
try:
|
||||||
with transaction.atomic():
|
|
||||||
# 先尝试获取(带锁)
|
# 先尝试获取(带锁)
|
||||||
try:
|
try:
|
||||||
obj = cls.objects.select_for_update().get(**kwargs)
|
obj = cls.objects.select_for_update().get(**kwargs)
|
||||||
|
@ -148,7 +147,7 @@ class BaseModel(models.Model):
|
||||||
if not self.id:
|
if not self.id:
|
||||||
is_create = True
|
is_create = True
|
||||||
self.id = idWorker.get_id()
|
self.id = idWorker.get_id()
|
||||||
with transaction.atomic():
|
|
||||||
old_parent = None
|
old_parent = None
|
||||||
need_handle_parent = False
|
need_handle_parent = False
|
||||||
if hasattr(self, "parent"):
|
if hasattr(self, "parent"):
|
||||||
|
|
Loading…
Reference in New Issue