From 09ede0ade7b028210f36d121c1b3edc59270242d Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Wed, 15 Sep 2021 14:25:51 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20speed=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/config/index.js | 2 +- packages/mitmproxy/src/lib/speed/SpeedTester.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/config/index.js b/packages/core/src/config/index.js index 318e8483..705e8adb 100644 --- a/packages/core/src/config/index.js +++ b/packages/core/src/config/index.js @@ -240,7 +240,7 @@ module.exports = { }, speedTest: { enabled: true, - interval: 120000, + interval: 60000, hostnameList: ['github.com'], dnsProviders: ['usa', 'quad9', 'rubyfish'] } diff --git a/packages/mitmproxy/src/lib/speed/SpeedTester.js b/packages/mitmproxy/src/lib/speed/SpeedTester.js index 1168ca47..56fbac19 100644 --- a/packages/mitmproxy/src/lib/speed/SpeedTester.js +++ b/packages/mitmproxy/src/lib/speed/SpeedTester.js @@ -81,7 +81,7 @@ class SpeedTester { } async test () { - if (this.testCount % 10 <= 3 || this.backupList.length === 0) { + if (this.backupList.length === 0 || this.testCount < 10 || this.testCount % 5 === 3) { const newList = await this.getIpListFromDns(this.dnsMap) const newBackupList = [...newList, ...this.backupList] this.backupList = _.unionBy(newBackupList, 'host')