refactor: speed 优化
parent
94800d780d
commit
09ede0ade7
|
@ -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']
|
||||||
}
|
}
|
||||||
|
|
|
@ -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')
|
||||||
|
|
Loading…
Reference in New Issue