修复抢购流程多项问题
- executeRound 四次加锁合并为单次,减少锁竞争 - shouldFallbackStandard token 匹配从宽泛改为精确匹配 cvl_csrf_token - retryCooldownDuration 新增操作频繁/请求过多/请求太频繁三种冷却匹配 - behaviorCooldown 从 8s 降为 5s - BestServerTimeCalibration 部分失败时不再返回 error,仅全败才报错 - warmupSchedule 增加 gen 计数器+warmupRunMu 互斥锁,防止 resync 时新旧预热并发 - ScheduleRun 中 clearWarmups 移入锁内 stopSchedulesLocked 之后执行
This commit is contained in:
@@ -138,6 +138,10 @@ func (c *DouyuClient) BestServerTimeCalibration(rounds int, maxWait time.Duratio
|
||||
Fallback: true,
|
||||
}, fmt.Errorf("斗鱼时间校准失败: %w", lastErr)
|
||||
}
|
||||
var calErr error
|
||||
if lastErr != nil {
|
||||
calErr = fmt.Errorf("斗鱼时间校准部分失败(已使用最优结果): %w", lastErr)
|
||||
}
|
||||
return types.TimeCalibration{
|
||||
Offset: best.Offset,
|
||||
ErrorBound: best.ErrorBound,
|
||||
@@ -146,7 +150,7 @@ func (c *DouyuClient) BestServerTimeCalibration(rounds int, maxWait time.Duratio
|
||||
CreatedAt: time.Now(),
|
||||
Source: best.Source,
|
||||
Fallback: best.Fallback,
|
||||
}, lastErr
|
||||
}, calErr
|
||||
}
|
||||
|
||||
func betterTimeSample(candidate, current types.TimeSample) bool {
|
||||
|
||||
Reference in New Issue
Block a user