Skip to content

Commit

Permalink
🔊 Add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
SPGoding committed Feb 7, 2025
1 parent 79390db commit dece859
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/core/src/service/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ export async function fetchWithCache(
const response = await web.fetch(request)
if (response.status === 304) {
Dev.assertDefined(cachedResponse)
logger.info(`[fetchWithCache] reusing cache for ${request.url}`)
return cachedResponse
} else {
try {
await cache.put(request, response)
logger.info(`[fetchWithCache] updated cache for ${request.url}`)
} catch (e) {
logger.warn('[fetchWithCache] put cache', e)
}
Expand All @@ -30,6 +32,7 @@ export async function fetchWithCache(
} catch (e) {
logger.warn('[fetchWithCache] fetch', e)
if (cachedResponse) {
logger.info(`[fetchWithCache] falling back to cache for ${request.url}`)
return cachedResponse
}
throw e
Expand Down

0 comments on commit dece859

Please sign in to comment.