chore: migrate to cacheable v2

This commit is contained in:
WebStreamr 2025-09-10 10:10:24 +00:00
parent d25ae14dee
commit 7cdbad8798
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View file

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

View file

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