feat: 登录流程整体重试机制 + 代理池耗尽等待恢复
- DouyuLogin.login() 添加整体重试循环,失败时换新代理从头重跑 - 新增 max_login_retries(默认3次)和 max_total_time(默认300秒) - 重试前重置 session cookies + 换新代理,避免残留状态 - 成功后归还代理到池;失败时标记代理坏 - 代理池耗尽时不再立即放弃账号,等待最多60秒恢复后再试 - API代理模式改为 DouyuLogin 内部通过 proxy_manager 自治管理 登录过程中的代理切换(极验、整体重试)不再由服务层预取 - Schema/LoginBatchRequest 添加 max_login_retries 和 max_total_time - 前端 API 调用改为对象参数形式,透传新参数
This commit is contained in:
@@ -1,9 +1,18 @@
|
||||
import api from './client';
|
||||
import type { BatchLoginResult, LoginTaskItem, MessageDeletedResponse, MessageResponse } from './types';
|
||||
|
||||
interface CreateBatchParams {
|
||||
account_ids: number[];
|
||||
max_geetest_retries?: number;
|
||||
concurrency?: number;
|
||||
max_proxy_retries?: number;
|
||||
max_login_retries?: number;
|
||||
max_total_time?: number;
|
||||
}
|
||||
|
||||
export const loginApi = {
|
||||
createBatch: (account_ids: number[], max_geetest_retries?: number, concurrency?: number, max_proxy_retries?: number) =>
|
||||
api.post<BatchLoginResult, BatchLoginResult>('/login/batch', { account_ids, max_geetest_retries, concurrency, max_proxy_retries }),
|
||||
createBatch: (params: CreateBatchParams) =>
|
||||
api.post<BatchLoginResult, BatchLoginResult>('/login/batch', params),
|
||||
listTasks: (batch_id?: string) =>
|
||||
api.get<LoginTaskItem[], LoginTaskItem[]>('/login/tasks', { params: batch_id ? { batch_id } : {} }),
|
||||
stop: (batch_id: string) => api.post<MessageResponse, MessageResponse>(`/login/stop/${batch_id}`),
|
||||
|
||||
Reference in New Issue
Block a user