Unverified Commit 98b43a07 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Update debug logs for app cache (#45291)

Cleans up the debug logs a bit to be more usable
parent 82fe0d91
...@@ -74,11 +74,10 @@ export default class FetchCache implements CacheHandler { ...@@ -74,11 +74,10 @@ export default class FetchCache implements CacheHandler {
} }
const items = await res.json() const items = await res.json()
const item = items[key] const item = items?.[key]
if (!item || !item.value) { if (!item || !item.value) {
console.log({ item }) throw new Error(`invalid item returned ${JSON.stringify({ item })}`)
throw new Error(`invalid item returned`)
} }
const cached = JSON.parse(item.value) const cached = JSON.parse(item.value)
...@@ -94,9 +93,9 @@ export default class FetchCache implements CacheHandler { ...@@ -94,9 +93,9 @@ export default class FetchCache implements CacheHandler {
} }
if (this.debug) { if (this.debug) {
console.log( console.log(
'got fetch cache entry duration:', `got fetch cache entry for ${key}, duration: ${
Date.now() - start, Date.now() - start
data }ms, size: ${item.value.length}`
) )
} }
...@@ -148,9 +147,9 @@ export default class FetchCache implements CacheHandler { ...@@ -148,9 +147,9 @@ export default class FetchCache implements CacheHandler {
if (this.debug) { if (this.debug) {
console.log( console.log(
'successfully set to fetch-cache duration:', `successfully set to fetch-cache for ${key}, duration: ${
Date.now() - start, Date.now() - start
body }ms, size: ${body.length}`
) )
} }
} catch (err) { } catch (err) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment