Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
watson committed Feb 19, 2025
1 parent 75e555e commit 22ab9c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/dd-trace/src/debugger/devtools_client/source-maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ const self = module.exports = {
//
// Source: https://github.com/nodejs/node/blob/v18.20.6/lib/async_hooks.js#L312
function cacheIt (key, value) {
if (Date.now() > cacheTimerLastSet + 1_000) {
const now = Date.now()
if (now > cacheTimerLastSet + 1_000) {
clearTimeout(cacheTimer)
cacheTimer = setTimeout(function () {
// Optimize for app boot, where a lot of reads might happen
// Clear cache a few seconds after it was last used
cache.clear()
}, 10_000).unref()
cacheTimerLastSet = Date.now()
cacheTimerLastSet = now
}
cache.set(key, value)
return value
Expand Down

0 comments on commit 22ab9c4

Please sign in to comment.