refactor: 1
parent
cb997a34f2
commit
efcf730a17
|
@ -237,7 +237,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
speedTest: {
|
speedTest: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
interval: 60000,
|
interval: 300000,
|
||||||
hostnameList: ['github.com'],
|
hostnameList: ['github.com'],
|
||||||
dnsProviders: ['usa', 'quad9', 'rubyfish']
|
dnsProviders: ['usa', 'quad9', 'rubyfish']
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ class SpeedTester {
|
||||||
this.loadingIps = false
|
this.loadingIps = false
|
||||||
this.loadingTest = false
|
this.loadingTest = false
|
||||||
|
|
||||||
|
this.testCount = 0
|
||||||
this.test()
|
this.test()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,9 +81,13 @@ class SpeedTester {
|
||||||
}
|
}
|
||||||
|
|
||||||
async test () {
|
async test () {
|
||||||
|
if (this.testCount % 10 === 0) {
|
||||||
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')
|
||||||
|
}
|
||||||
|
this.testCount++
|
||||||
|
|
||||||
log.info('[speed]', this.hostname, ' ips:', this.backupList)
|
log.info('[speed]', this.hostname, ' ips:', this.backupList)
|
||||||
await this.testBackups()
|
await this.testBackups()
|
||||||
if (config.notify) {
|
if (config.notify) {
|
||||||
|
|
Loading…
Reference in New Issue