From 731bd334703f0592f083d4264c382c28acf68eb1 Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Sat, 13 Sep 2025 17:41:28 +0000 Subject: [PATCH] chore(fetcher): log more infos about responses --- src/utils/Fetcher.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/Fetcher.ts b/src/utils/Fetcher.ts index 4a96035..9731d44 100644 --- a/src/utils/Fetcher.ts +++ b/src/utils/Fetcher.ts @@ -235,7 +235,7 @@ export class Fetcher { let httpCacheItem = await this.cacheGet(cacheKey); const noCache = init?.noCache ?? false; if (httpCacheItem && !noCache) { - this.logger.info(`Cached fetch ${request.method} ${url}`, ctx); + this.logger.info(`Cached fetch ${request.method} ${url}: ${httpCacheItem.status} (${httpCacheItem.statusText})`, ctx); return this.handleHttpCacheItem(ctx, httpCacheItem, url, init); } @@ -260,7 +260,7 @@ export class Fetcher { if (isRateLimitedRaw && isRateLimitedRaw.value && isRateLimitedRaw.expires) { const ttl = isRateLimitedRaw.expires - Date.now(); if (ttl <= this.MAX_WAIT_RETRY_AFTER && tryCount < 1) { - this.logger.info('Wait out rate limit', ctx); + this.logger.info(`Wait out rate limit for ${url}`, ctx); await this.sleep(ttl); @@ -292,6 +292,8 @@ export class Fetcher { response = await fetch(finalUrl, finalInit); } catch (error) { + this.logger.info(`Got error ${error} for ${url}`, ctx); + if (error instanceof DOMException && ['AbortError', 'TimeoutError'].includes(error.name)) { await this.increaseTimeoutsCount(url); throw new TimeoutError(); @@ -300,6 +302,8 @@ export class Fetcher { throw error; } + this.logger.info(`Got ${response.status} (${response.statusText}) for ${url}`, ctx); + await this.decreaseTimeoutsCount(url); if (response.status === 429) {