fix: 修复向量化失败,缓存未被删除 (#887)

This commit is contained in:
shaohuzhang1 2024-07-29 16:17:30 +08:00 committed by GitHub
parent 3c7142ed7c
commit 6aa2a682bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -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': "下载程序被中断,请重试"})

View File

@ -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