From 9f90838df1041ca7a02a6c110f4f739b322889dd Mon Sep 17 00:00:00 2001 From: wangruidong <940853815@qq.com> Date: Wed, 6 Nov 2024 17:57:56 +0800 Subject: [PATCH] perf: Optimize username handling in push_account --- apps/accounts/models/automations/push_account.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/accounts/models/automations/push_account.py b/apps/accounts/models/automations/push_account.py index 99bbda01d..c5d47d451 100644 --- a/apps/accounts/models/automations/push_account.py +++ b/apps/accounts/models/automations/push_account.py @@ -2,7 +2,7 @@ from django.conf import settings from django.db import models from django.utils.translation import gettext_lazy as _ -from accounts.const import AutomationTypes +from accounts.const import AutomationTypes, SecretType from accounts.models import Account from .base import AccountBaseAutomation from .change_secret import ChangeSecretMixin @@ -23,7 +23,8 @@ class PushAccountAutomation(ChangeSecretMixin, AccountBaseAutomation): create_usernames = set(usernames) - set(account_usernames) create_account_objs = [ Account( - name=f'{username}-{secret_type}', username=username, + name=f"{username}-{secret_type}" if secret_type != SecretType.PASSWORD else username, + username=username, secret_type=secret_type, asset=asset, ) for username in create_usernames