chore: migrate to cacheable v2
This commit is contained in:
parent
d25ae14dee
commit
7cdbad8798
2 changed files with 2 additions and 2 deletions
|
|
@ -39,7 +39,7 @@ export class ExtractorRegistry {
|
|||
? `${extractor.id}_${normalizedUrl}_${ctx.config.mediaFlowProxyUrl}`
|
||||
: `${extractor.id}_${normalizedUrl}`;
|
||||
|
||||
const storedDataRaw = await this.urlResultCache.get<UrlResult[]>(cacheKey, { raw: true });
|
||||
const storedDataRaw = await this.urlResultCache.getRaw<UrlResult[]>(cacheKey);
|
||||
const expires = storedDataRaw?.expires;
|
||||
if (storedDataRaw && expires) {
|
||||
// Ignore the cache randomly after at least 2/3 of the TTL passed to start refreshing results slowly
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ export class Fetcher {
|
|||
protected async fetchWithTimeout(ctx: Context, url: URL, init?: CustomRequestInit, tryCount = 0): Promise<Response> {
|
||||
this.logger.info(`Fetch ${init?.method ?? 'GET'} ${url}`, ctx);
|
||||
|
||||
const isRateLimitedRaw = await this.rateLimitedCache.get<true>(url.host, { raw: true });
|
||||
const isRateLimitedRaw = await this.rateLimitedCache.getRaw<true>(url.host);
|
||||
/* istanbul ignore if */
|
||||
if (isRateLimitedRaw && isRateLimitedRaw.value && isRateLimitedRaw.expires) {
|
||||
const ttl = isRateLimitedRaw.expires - Date.now();
|
||||
|
|
|
|||
Loading…
Reference in a new issue