refactor(knowledge): migrate deleted-item cleanup from polling scheduler to event-driven worker

Replaces the scheduler-polled KnowledgeDeletedCleanupWorker with an
event-driven KnowledgeDeletedCleanupEventWorker in tenant-api; cleanup
events are now enqueued transactionally at delete time instead of swept
periodically. Also fixes statement_timeout parameterization in
MonitoringRetentionWorker and propagates errors from cleanupDeletedKnowledgeItem.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-20 11:22:37 +08:00
parent e82ae56236
commit 4b09a34748
11 changed files with 474 additions and 149 deletions
@@ -0,0 +1,4 @@
DROP INDEX IF EXISTS idx_knowledge_deleted_cleanup_processing;
DROP INDEX IF EXISTS idx_knowledge_deleted_cleanup_pending;
DROP INDEX IF EXISTS uk_knowledge_deleted_cleanup_open;
DROP TABLE IF EXISTS knowledge_deleted_cleanup_events;