Skip to content

Commit

Permalink
fix(cache): avoid destructuring if null
Browse files Browse the repository at this point in the history
  • Loading branch information
Atinux committed Apr 18, 2024
1 parent 411d98e commit 7565284
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/runtime/server/api/_hub/cache/[...key].get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default eventHandler(async (event) => {
return
}
const item = await storage.getItem(key)
if (!item) return
const { value, ...meta } = item

const entry = {
Expand All @@ -40,7 +41,6 @@ export default eventHandler(async (event) => {
entry.duration = ms(meta.expires - meta.mtime, { long: true })
} catch (err) {
entry.duration = 'unknown'
console.log('Cannot have ms duration', key, err)
}
stats.cache.push(entry)
}))
Expand Down

0 comments on commit 7565284

Please sign in to comment.