Skip to content

Commit 0bca2ae

Browse files
优化
1 parent 67053ce commit 0bca2ae

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • packages/mitmproxy/src/lib/choice

packages/mitmproxy/src/lib/choice/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,14 @@ class DynamicChoice {
116116

117117
// 计算成功率
118118
count.successRate = 1.0 - (count.error / count.total)
119+
120+
// 判断是否需要切换下一个
119121
if (isError && this.value === ip) {
120-
// 连续错误3次,切换下一个
121122
if (count.keepErrorCount >= 3) {
123+
// 连续错误3次,切换下一个
122124
this.changeNext(count)
123-
}
124-
// 成功率小于40%,切换下一个
125-
if (count.successRate < 0.4) {
125+
} else if (count.successRate < 0.4) {
126+
// 成功率小于40%,切换下一个
126127
this.changeNext(count)
127128
}
128129
}

0 commit comments

Comments
 (0)