fix: 修复项目重启后文档状态不正确 (#1754)
This commit is contained in:
parent
6bca0a8558
commit
c4c4b6e9cd
@ -10,8 +10,14 @@ import setting.models
|
|||||||
from setting.models import Model
|
from setting.models import Model
|
||||||
from .listener_manage import *
|
from .listener_manage import *
|
||||||
|
|
||||||
|
update_document_status_sql = """
|
||||||
|
UPDATE "public"."document"
|
||||||
|
SET status ="replace"("replace"("replace"(status, '1', '3'), '0', '3'), '4', '3')
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
# QuerySet(Document).filter(status__in=[Status.embedding, Status.queue_up]).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,
|
QuerySet(Model).filter(status=setting.models.Status.DOWNLOAD).update(status=setting.models.Status.ERROR,
|
||||||
meta={'message': "下载程序被中断,请重试"})
|
meta={'message': "下载程序被中断,请重试"})
|
||||||
|
update_execute(update_document_status_sql, [])
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
@desc:
|
@desc:
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
from smartdoc.const import CONFIG, PROJECT_DIR
|
from smartdoc.const import CONFIG, PROJECT_DIR
|
||||||
|
|
||||||
@ -34,6 +35,11 @@ CELERY_TASK_SOFT_TIME_LIMIT = 3600
|
|||||||
CELERY_WORKER_CANCEL_LONG_RUNNING_TASKS_ON_CONNECTION_LOSS = True
|
CELERY_WORKER_CANCEL_LONG_RUNNING_TASKS_ON_CONNECTION_LOSS = True
|
||||||
CELERY_ACKS_LATE = True
|
CELERY_ACKS_LATE = True
|
||||||
celery_once_path = os.path.join(celery_data_dir, "celery_once")
|
celery_once_path = os.path.join(celery_data_dir, "celery_once")
|
||||||
|
try:
|
||||||
|
if os.path.exists(celery_once_path) and os.path.isdir(celery_once_path):
|
||||||
|
shutil.rmtree(celery_once_path)
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
CELERY_ONCE = {
|
CELERY_ONCE = {
|
||||||
'backend': 'celery_once.backends.File',
|
'backend': 'celery_once.backends.File',
|
||||||
'settings': {'location': celery_once_path}
|
'settings': {'location': celery_once_path}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user