From 6aa2a682bc89e92a14c7cd4b746b45fb232609b9 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 <80892890+shaohuzhang1@users.noreply.github.com> Date: Mon, 29 Jul 2024 16:17:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=90=91=E9=87=8F?= =?UTF-8?q?=E5=8C=96=E5=A4=B1=E8=B4=A5,=E7=BC=93=E5=AD=98=E6=9C=AA?= =?UTF-8?q?=E8=A2=AB=E5=88=A0=E9=99=A4=20(#887)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/event/__init__.py | 2 +- apps/common/event/common.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/common/event/__init__.py b/apps/common/event/__init__.py index 909740b7a..462d8da79 100644 --- a/apps/common/event/__init__.py +++ b/apps/common/event/__init__.py @@ -13,6 +13,6 @@ from .listener_manage import * def run(): listener_manage.ListenerManagement().run() - QuerySet(Document).filter(status=Status.embedding).update(**{'status': Status.error}) + QuerySet(Document).filter(status__in=[Status.embedding, Status.queue_up]).update(**{'status': Status.error}) QuerySet(Model).filter(status=setting.models.Status.DOWNLOAD).update(status=setting.models.Status.ERROR, meta={'message': "下载程序被中断,请重试"}) diff --git a/apps/common/event/common.py b/apps/common/event/common.py index 480748c31..a723592c5 100644 --- a/apps/common/event/common.py +++ b/apps/common/event/common.py @@ -30,8 +30,10 @@ def get_cache_key(poxy_function, args): def get_cache_poxy_function(poxy_function, cache_key): def fun(args, **keywords): - poxy_function(args, **keywords) - memory_cache.delete(cache_key) + try: + poxy_function(args, **keywords) + finally: + memory_cache.delete(cache_key) return fun