docs: 小修改
parent
d6c8e85f2f
commit
41cb44967d
|
@ -20,7 +20,7 @@ module.exports = {
|
|||
'/.*/.*/blame/': {
|
||||
redirect: 'hub.fastgit.org'
|
||||
},
|
||||
'/.+/[^\\/]+$': {
|
||||
'^/[^/]+/[^/]+$': {
|
||||
script: [
|
||||
'jquery',
|
||||
'github'
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const LRU = require('lru-cache')
|
||||
const cacheSize = 1024
|
||||
const log = require('../../utils/util.log')
|
||||
class ChoiceCache {
|
||||
constructor () {
|
||||
this.cache = new LRU(cacheSize)
|
||||
|
@ -52,7 +53,7 @@ class DynamicChoice {
|
|||
list.sort((a, b) => {
|
||||
return b.successRate - a.successRate
|
||||
})
|
||||
console.log('do rank', list)
|
||||
log.info('do rank', JSON.stringify(list))
|
||||
const backup = list.map(item => item.value)
|
||||
|
||||
this.setBackupList(backup)
|
||||
|
|
|
@ -4,12 +4,16 @@ module.exports = {
|
|||
const { rOptions, log, RequestCounter } = context
|
||||
|
||||
let proxyConf = interceptOpt.proxy
|
||||
if (RequestCounter && interceptOpt.backup && interceptOpt.backup.length > 0) {
|
||||
if (RequestCounter) {
|
||||
// 优选逻辑
|
||||
const backup = [proxyConf]
|
||||
for (const bk of interceptOpt.backup) {
|
||||
backup.push(bk)
|
||||
if (interceptOpt.backup) {
|
||||
for (const bk of interceptOpt.backup) {
|
||||
backup.push(bk)
|
||||
}
|
||||
}
|
||||
backup.push(rOptions.hostname)
|
||||
|
||||
const key = interceptOpt.key
|
||||
const count = RequestCounter.getOrCreate(key, backup)
|
||||
if (count.value == null) {
|
||||
|
|
Loading…
Reference in New Issue