From 4000986d1d85b53a539c5d3b4f88ee476ba8d2a8 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 9 May 2023 19:53:29 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/terminal/models/applet/applet.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/terminal/models/applet/applet.py b/apps/terminal/models/applet/applet.py index 8bf6b3a85..be8f1e2cc 100644 --- a/apps/terminal/models/applet/applet.py +++ b/apps/terminal/models/applet/applet.py @@ -161,7 +161,9 @@ class Applet(JMSBaseModel): return None prefer_host_account_key = 'applet_host_prefer_account_{}_{}'.format(user.id, host.id) prefer_account_id = cache.get(prefer_host_account_key, None) - prefer_account = accounts.filter(id=prefer_account_id).first() + prefer_account = None + if prefer_account_id: + prefer_account = accounts.filter(id=prefer_account_id).first() if prefer_account: account = prefer_account else: