fix(proxy): 完善备用补提与失败组暂停

- 备用不足不再触发活动代理池重建\n- 白名单 verify 限频错误保留消息并允许重试\n- 严格模式失败组暂停请求并持续补提取\n- 增加备用代理健康探测与运行门禁校验
This commit is contained in:
yml
2026-11-21 22:01:48 +08:00
parent d37fd50233
commit 5b2dc22eb5
9 changed files with 440 additions and 26 deletions
+31 -1
View File
@@ -112,12 +112,22 @@ type attemptOutcome struct {
// 这不是"没抢到",而是"发早了"。它不该消耗账号的重试节奏,
// 更不该触发限流降频——否则有效尝试次数会白白浪费在活动开始之前。
notStarted bool
// paused 表示账号所属代理组已故障,当前正在等待备用代理或补提取。
paused bool
}
// runAccountAttempt 按活动执行一次完整尝试。
func (s *Scheduler) runAccountAttempt(attempt types.ExchangeAttempt, mode types.SeckillMode, ctl *runControl) attemptOutcome {
cli := s.clientForAccount(attempt.Account.Name)
if cli == nil {
if s.accountProxyPaused(attempt.Account.Name) {
return attemptOutcome{result: types.ExchangeResult{
Account: attempt.Account.Name,
Product: attempt.Product.CommodityName,
Attempt: attempt.Index,
Message: "等待备用代理",
}, paused: true}
}
return attemptOutcome{result: types.ExchangeResult{
Account: attempt.Account.Name,
Product: attempt.Product.CommodityName,
@@ -146,6 +156,14 @@ func (s *Scheduler) runAccountAttempt(attempt types.ExchangeAttempt, mode types.
func (s *Scheduler) runPeaceLockPay(attempt types.ExchangeAttempt, ctl *runControl) attemptOutcome {
cli := s.clientForAccount(attempt.Account.Name)
if cli == nil {
if s.accountProxyPaused(attempt.Account.Name) {
return attemptOutcome{result: types.ExchangeResult{
Account: attempt.Account.Name,
Product: attempt.Product.CommodityName,
Attempt: attempt.Index,
Message: "等待备用代理",
}, paused: true}
}
return attemptOutcome{result: types.ExchangeResult{
Account: attempt.Account.Name,
Product: attempt.Product.CommodityName,
@@ -342,6 +360,14 @@ func (s *Scheduler) payOnce(cli *client.DouyuClient, attempt types.ExchangeAttem
func (s *Scheduler) runDirectExchange(attempt types.ExchangeAttempt, reuseCache bool, ctl *runControl) attemptOutcome {
cli := s.clientForAccount(attempt.Account.Name)
if cli == nil {
if s.accountProxyPaused(attempt.Account.Name) {
return attemptOutcome{result: types.ExchangeResult{
Account: attempt.Account.Name,
Product: attempt.Product.CommodityName,
Attempt: attempt.Index,
Message: "等待备用代理",
}, paused: true}
}
return attemptOutcome{result: types.ExchangeResult{
Account: attempt.Account.Name,
Product: attempt.Product.CommodityName,
@@ -486,7 +512,11 @@ func (s *Scheduler) runXiaodianAttempt(attempt types.ExchangeAttempt) types.Exch
return result
}
if cli == nil {
result.Message = "失败|没有可用代理客户端"
if s.accountProxyPaused(attempt.Account.Name) {
result.Message = "等待备用代理"
} else {
result.Message = "失败|没有可用代理客户端"
}
return result
}