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
@ -526,4 +524,4 @@ def delete_knowledge_graph(tenant_id,dataset_id):
_, kb = KnowledgebaseService.get_by_id(dataset_id)
settings.docStoreConn.delete({"knowledge_graph_kwd": ["graph", "subgraph", "entity", "relation"]}, search.index_name(kb.tenant_id), dataset_id)
return get_result(data=True)
return get_result(data=True)

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 = []