refactor: speed 优化

pull/192/head
xiaojunnuo 2021-09-15 14:25:51 +08:00
parent 94800d780d
commit 09ede0ade7
2 changed files with 2 additions and 2 deletions

View File

@ -240,7 +240,7 @@ module.exports = {
}, },
speedTest: { speedTest: {
enabled: true, enabled: true,
interval: 120000, interval: 60000,
hostnameList: ['github.com'], hostnameList: ['github.com'],
dnsProviders: ['usa', 'quad9', 'rubyfish'] dnsProviders: ['usa', 'quad9', 'rubyfish']
} }

View File

@ -81,7 +81,7 @@ class SpeedTester {
} }
async test () { 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 newList = await this.getIpListFromDns(this.dnsMap)
const newBackupList = [...newList, ...this.backupList] const newBackupList = [...newList, ...this.backupList]
this.backupList = _.unionBy(newBackupList, 'host') this.backupList = _.unionBy(newBackupList, 'host')