mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-08 10:27:46 +08:00
feat(cleanup): 解耦 request_candidates 与 provider_api_keys 生命周期
- 移除 request_candidates.key_id 对 provider_api_keys 的外键约束(含迁移脚本) - 删除 Key 时不再级联删除候选记录,改为独立按保留天数定时清理 - 新增 request_candidates_retention_days / request_candidates_cleanup_batch_size 配置项 - batch_delete_task 增加 lock_timeout 及超时自动降批重试机制 - cleanup_key_references 提取阶段化清理流程,移除 RequestCandidate 联动删除 - 前端 CleanupPolicySection 新增候选记录保留天数和清理批次配置 Closes #227 Co-authored-by: Entropy-Xu <[email protected]>
This commit is contained in:
@@ -32,6 +32,8 @@ export interface SystemConfig {
|
||||
log_retention_days: number
|
||||
cleanup_batch_size: number
|
||||
audit_log_retention_days: number
|
||||
request_candidates_retention_days: number
|
||||
request_candidates_cleanup_batch_size: number
|
||||
// 定时任务
|
||||
enable_provider_checkin: boolean
|
||||
provider_checkin_time: string
|
||||
@@ -66,6 +68,8 @@ const CONFIG_KEYS = [
|
||||
'log_retention_days',
|
||||
'cleanup_batch_size',
|
||||
'audit_log_retention_days',
|
||||
'request_candidates_retention_days',
|
||||
'request_candidates_cleanup_batch_size',
|
||||
// 定时任务
|
||||
'enable_provider_checkin',
|
||||
'provider_checkin_time',
|
||||
@@ -101,6 +105,8 @@ function createDefaultConfig(): SystemConfig {
|
||||
log_retention_days: 365,
|
||||
cleanup_batch_size: 1000,
|
||||
audit_log_retention_days: 30,
|
||||
request_candidates_retention_days: 30,
|
||||
request_candidates_cleanup_batch_size: 5000,
|
||||
// 定时任务
|
||||
enable_provider_checkin: true,
|
||||
provider_checkin_time: '01:05',
|
||||
@@ -171,7 +177,11 @@ export function useSystemConfig() {
|
||||
systemConfig.value.log_retention_days !== originalConfig.value.log_retention_days ||
|
||||
systemConfig.value.cleanup_batch_size !== originalConfig.value.cleanup_batch_size ||
|
||||
systemConfig.value.audit_log_retention_days !==
|
||||
originalConfig.value.audit_log_retention_days
|
||||
originalConfig.value.audit_log_retention_days ||
|
||||
systemConfig.value.request_candidates_retention_days !==
|
||||
originalConfig.value.request_candidates_retention_days ||
|
||||
systemConfig.value.request_candidates_cleanup_batch_size !==
|
||||
originalConfig.value.request_candidates_cleanup_batch_size
|
||||
)
|
||||
})
|
||||
|
||||
@@ -421,6 +431,16 @@ export function useSystemConfig() {
|
||||
value: systemConfig.value.audit_log_retention_days,
|
||||
description: '审计日志保留天数',
|
||||
},
|
||||
{
|
||||
key: 'request_candidates_retention_days',
|
||||
value: systemConfig.value.request_candidates_retention_days,
|
||||
description: '请求候选记录保留天数',
|
||||
},
|
||||
{
|
||||
key: 'request_candidates_cleanup_batch_size',
|
||||
value: systemConfig.value.request_candidates_cleanup_batch_size,
|
||||
description: '请求候选记录每批次清理条数',
|
||||
},
|
||||
]
|
||||
|
||||
await Promise.all(
|
||||
@@ -438,6 +458,10 @@ export function useSystemConfig() {
|
||||
originalConfig.value.cleanup_batch_size = systemConfig.value.cleanup_batch_size
|
||||
originalConfig.value.audit_log_retention_days =
|
||||
systemConfig.value.audit_log_retention_days
|
||||
originalConfig.value.request_candidates_retention_days =
|
||||
systemConfig.value.request_candidates_retention_days
|
||||
originalConfig.value.request_candidates_cleanup_batch_size =
|
||||
systemConfig.value.request_candidates_cleanup_batch_size
|
||||
}
|
||||
success('请求记录清理配置已保存')
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user