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/': { '/.*/.*/blame/': {
redirect: 'hub.fastgit.org' redirect: 'hub.fastgit.org'
}, },
'/.+/[^\\/]+$': { '^/[^/]+/[^/]+$': {
script: [ script: [
'jquery', 'jquery',
'github' 'github'

View File

@ -1,5 +1,6 @@
const LRU = require('lru-cache') const LRU = require('lru-cache')
const cacheSize = 1024 const cacheSize = 1024
const log = require('../../utils/util.log')
class ChoiceCache { class ChoiceCache {
constructor () { constructor () {
this.cache = new LRU(cacheSize) this.cache = new LRU(cacheSize)
@ -52,7 +53,7 @@ class DynamicChoice {
list.sort((a, b) => { list.sort((a, b) => {
return b.successRate - a.successRate return b.successRate - a.successRate
}) })
console.log('do rank', list) log.info('do rank', JSON.stringify(list))
const backup = list.map(item => item.value) const backup = list.map(item => item.value)
this.setBackupList(backup) this.setBackupList(backup)

View File

@ -4,12 +4,16 @@ module.exports = {
const { rOptions, log, RequestCounter } = context const { rOptions, log, RequestCounter } = context
let proxyConf = interceptOpt.proxy let proxyConf = interceptOpt.proxy
if (RequestCounter && interceptOpt.backup && interceptOpt.backup.length > 0) { if (RequestCounter) {
// 优选逻辑 // 优选逻辑
const backup = [proxyConf] const backup = [proxyConf]
for (const bk of interceptOpt.backup) { if (interceptOpt.backup) {
backup.push(bk) for (const bk of interceptOpt.backup) {
backup.push(bk)
}
} }
backup.push(rOptions.hostname)
const key = interceptOpt.key const key = interceptOpt.key
const count = RequestCounter.getOrCreate(key, backup) const count = RequestCounter.getOrCreate(key, backup)
if (count.value == null) { if (count.value == null) {