@creditkarma/async-scope
Advanced tools
Comparing version 0.0.12 to 0.0.13
@@ -30,10 +30,2 @@ "use strict"; | ||
} | ||
if (self.asyncMap.oldestId === -1) { | ||
self.asyncMap.oldestId = asyncId; | ||
} | ||
const previousNode = self.asyncMap[self.previousId]; | ||
if (previousNode !== undefined) { | ||
previousNode.nextId = asyncId; | ||
} | ||
self.previousId = asyncId; | ||
self._purge(); | ||
@@ -86,6 +78,10 @@ }, | ||
this.asyncMap.oldestId = nodeToDelete.nextId; | ||
this.asyncMap.size -= 1; | ||
if (nodeToDelete.parentId !== null) { | ||
const parentNode = this.asyncMap[nodeToDelete.parentId]; | ||
if (parentNode !== undefined) { | ||
parentNode.children.splice(parentNode.children.indexOf(oldestId), 1); | ||
const indexToRemove = parentNode.children.indexOf(oldestId); | ||
if (indexToRemove > -1) { | ||
parentNode.children.splice(indexToRemove, 1); | ||
} | ||
} | ||
@@ -97,6 +93,3 @@ } | ||
if (this.asyncMap[asyncId] === undefined) { | ||
if (this.asyncMap.size < this.maxSize) { | ||
this.asyncMap.size += 1; | ||
} | ||
else { | ||
if (this.asyncMap.size >= this.maxSize) { | ||
this._removeOldest(); | ||
@@ -113,2 +106,11 @@ } | ||
}; | ||
if (this.asyncMap.oldestId === -1) { | ||
this.asyncMap.oldestId = asyncId; | ||
} | ||
const previousNode = this.asyncMap[this.previousId]; | ||
if (previousNode !== undefined) { | ||
previousNode.nextId = asyncId; | ||
} | ||
this.previousId = asyncId; | ||
this.asyncMap.size += 1; | ||
} | ||
@@ -115,0 +117,0 @@ } |
{ | ||
"name": "@creditkarma/async-scope", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "A thread local approximation built on async hooks, written in TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/main/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36544
310