mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
perf: Pool 批量删除改为异步任务模式,避免大批量删除阻塞请求
- 新增 batch_delete_task 模块,提交删除后立即返回 task_id,后台线程分批执行 - 新增查询任务进度的 API 端点,前端轮询展示实时进度 - RequestCandidate 大表清理改为按行数分批删除,防止单条语句超时
This commit is contained in:
@@ -213,7 +213,7 @@ export async function listPoolKeys(
|
||||
export async function batchActionPoolKeys(
|
||||
providerId: string,
|
||||
body: PoolBatchAction,
|
||||
): Promise<{ affected: number; message: string }> {
|
||||
): Promise<{ affected: number; message: string; task_id?: string }> {
|
||||
const response = await client.post(
|
||||
`/api/admin/pool/${providerId}/keys/batch-action`,
|
||||
body,
|
||||
@@ -222,6 +222,24 @@ export async function batchActionPoolKeys(
|
||||
return response.data
|
||||
}
|
||||
|
||||
export interface BatchDeleteTaskStatus {
|
||||
task_id: string
|
||||
status: 'pending' | 'running' | 'completed' | 'failed'
|
||||
total: number
|
||||
deleted: number
|
||||
message: string
|
||||
}
|
||||
|
||||
export async function getPoolBatchDeleteTask(
|
||||
providerId: string,
|
||||
taskId: string,
|
||||
): Promise<BatchDeleteTaskStatus> {
|
||||
const response = await client.get<BatchDeleteTaskStatus>(
|
||||
`/api/admin/pool/${providerId}/keys/batch-delete-task/${taskId}`,
|
||||
)
|
||||
return response.data
|
||||
}
|
||||
|
||||
export async function cleanupBannedPoolKeys(
|
||||
providerId: string,
|
||||
): Promise<{ affected: number; message: string }> {
|
||||
|
||||
Reference in New Issue
Block a user