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:
+3
-1
@@ -353,7 +353,9 @@ func (c *Client) ListKnowledgeWithFilter(ctx context.Context,
|
||||
return response.Data, response.Total, nil
|
||||
}
|
||||
|
||||
// DeleteKnowledge deletes a knowledge entry by its ID
|
||||
// DeleteKnowledge enqueues an asynchronous delete for the given knowledge entry.
|
||||
// The server returns 200 once the task has been submitted; the actual deletion is
|
||||
// performed by a background worker (same pipeline as BatchDeleteKnowledge).
|
||||
func (c *Client) DeleteKnowledge(ctx context.Context, knowledgeID string) error {
|
||||
path := fmt.Sprintf("/api/v1/knowledge/%s", knowledgeID)
|
||||
resp, err := c.doRequest(ctx, http.MethodDelete, path, nil, nil)
|
||||
|
||||
Reference in New Issue
Block a user