Skip to content

Commit

Permalink
remove down cache
Browse files Browse the repository at this point in the history
  • Loading branch information
simon300000 committed Sep 7, 2023
1 parent d439380 commit 3afcd42
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions api/spider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import LRU from 'lru-cache'

import { fetch } from './dispatcher.js'

import { MusicData, MusicCore, PlayerValue, RawAPI, RankKey, MusicTagList, genKey } from './type.js'
Expand All @@ -16,10 +14,6 @@ import { SPIDER_PARALLEL } from './config.js'

const waits = new Map<string, Wait>()

const downCache = new LRU<string, any>({
maxAge: 1000 * 60 * 60
})

let spiders = SPIDER_PARALLEL

let musicList: MusicData[] = []
Expand All @@ -43,12 +37,7 @@ const sumLock = ({ uid, difficulty, platform }: RankKey) => {
}

const down = async <T>(url: string) => {
const hit = downCache.get(url)
if (hit) {
return hit as T
}
const result = await fetch(url)
downCache.set(url, result)
return result as T
}

Expand Down

0 comments on commit 3afcd42

Please sign in to comment.