修复hanjutv分页游标异常导致循环卡住并优化弹幕累加性能 (#209)
* 修复韩剧TV分页游标不前进导致的循环卡住 变更内容:在 getEpisodeDanmu 分页循环中增加 nextAxis <= fromAxis 时的退出条件,防止上游异常游标导致请求无限循环。 * 优化韩剧TV弹幕累加降低内存抖动 变更内容:将 getEpisodeDanmu 中 allDanmus.concat(...) 改为 push(... ) 原地追加,减少分页循环中的数组复制开销。
This commit is contained in:
1 parent
10b2ca89ae
commit
02f677eba8
1 file changed
+4
-1
@@ -467,7 +467,7 @@ export default class HanjutvSource extends BaseSource {
|
||||
|
||||
// 将当前请求的 episodes 拼接到总数组
|
||||
if (resp.data && resp.data.danmus) {
|
||||
allDanmus = allDanmus.concat(resp.data.danmus);
|
||||
allDanmus.push(...resp.data.danmus);
|
||||
}
|
||||
|
||||
// 获取 nextAxis,更新 fromAxis
|
||||
@@ -475,6 +475,9 @@ export default class HanjutvSource extends BaseSource {
|
||||
if (nextAxis >= maxAxis) {
|
||||
break; // 如果 nextAxis 达到或超过最大值,退出循环
|
||||
}
|
||||
if (nextAxis <= fromAxis) {
|
||||
break; // 如果 nextAxis 未前进,退出循环,避免卡死
|
||||
}
|
||||
fromAxis = nextAxis;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user