refactor(knowledge): route single delete through async pipeline
Reuse enqueueKnowledgeListDelete inside DeleteKnowledge so that single-item delete shares the same hardening as BatchDeleteKnowledge / ClearKnowledgeBase: asynq retries, business-aware queue routing, and marking-as-deleting inside the worker. The endpoint now returns 200 once the delete task has been enqueued; the response body carries the asynq task_id and the message is updated to "Delete task submitted". Swagger annotations, generated docs and the Go client SDK comment are updated to reflect the new asynchronous semantics. Note: this is a behavior change. Callers that previously assumed the knowledge was already gone on a 200 response should poll the task status or accept eventual consistency, matching the existing BatchDeleteKnowledge contract.
This commit is contained in:
+2
-2
@@ -5926,7 +5926,7 @@ const docTemplate = `{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据ID删除知识条目",
|
||||
"description": "根据ID异步删除知识条目。请求会被入队到与批量删除相同的异步管道(asynq);\n接口返回 200 仅表示任务已提交(响应 data.task_id 为任务 ID),实际删除由后台 worker 完成。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -5948,7 +5948,7 @@ const docTemplate = `{
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "删除成功",
|
||||
"description": "任务已提交,返回 task_id",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
|
||||
Reference in New Issue
Block a user