perf: update templat account (#10274)

Co-authored-by: feng <1304903146@qq.com>
pull/10276/head
fit2bot 2023-04-20 14:43:40 +08:00 committed by GitHub
parent 7887548174
commit 0de6c41406
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -1,3 +1,4 @@
from django.db.transaction import atomic
from django.db.utils import IntegrityError
from accounts.models import AccountTemplate, Account
@ -20,6 +21,7 @@ class AccountTemplateSerializer(BaseAccountSerializer):
pass
# TODO 数据库访问的太多了 后期优化
@atomic()
def bulk_update_accounts(self, instance, diff):
accounts = Account.objects.filter(source_id=instance.id)
if not accounts: