Fix:When deleting a knowledge base that is currently performing a parsing task, the parsing queue will not be deleted! (#9018)

### What problem does this PR solve?

https://github.com/infiniflow/ragflow/issues/8995

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

---------

Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
This commit is contained in:
Stephen Hu
2025-07-28 17:32:12 +08:00
committed by GitHub
parent 35b1a5b7e0
commit 5e7aaf2c41
2 changed files with 3 additions and 3 deletions

View File

@ -18,10 +18,8 @@
import logging
import os
import json
from flask import request
from peewee import OperationalError
from api import settings
from api.db import FileSource, StatusEnum
from api.db.db_models import File

View File

@ -229,8 +229,10 @@ class DocumentService(CommonService):
@classmethod
@DB.connection_context()
def remove_document(cls, doc, tenant_id):
from api.db.services.task_service import TaskService
cls.clear_chunk_num(doc.id)
try:
TaskService.filter_delete(Task.doc_id == doc.id)
page = 0
page_size = 1000
all_chunk_ids = []