docs: 小修改

pull/180/head
xiaojunnuo 2020-11-17 18:43:08 +08:00
parent d6c8e85f2f
commit 41cb44967d
3 changed files with 10 additions and 5 deletions

View File

@ -20,7 +20,7 @@ module.exports = {
'/.*/.*/blame/': {
redirect: 'hub.fastgit.org'
},
'/.+/[^\\/]+$': {
'^/[^/]+/[^/]+$': {
script: [
'jquery',
'github'

View File

@ -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)

View File

@ -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) {