Skip to content

Commit f628695

Browse files
committed
Better monitoring.
1 parent de4af05 commit f628695

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 2.0.8 (December 20, 2020)
4+
5+
- Better reporting, safe child getters.
6+
37
## 2.0.7 (December 20, 2020)
48

59
- Preferring `setImmediate` over `nextTick`.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-execution-context",
3-
"version": "2.0.7",
3+
"version": "2.0.8",
44
"description": "Provides execution context wrapper for node JS, can be used to create execution wrapper for handling requests and more",
55
"author": "Oded Goldglas <odedglas@gmail.com>",
66
"license": "ISC",

src/lib/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ module.exports = {
4141
*/
4242
monitorMap: (executionContextMap) => {
4343
const now = Date.now();
44-
const entries = [...executionContextMap.values()]
44+
const mapEntries = [...executionContextMap.values()];
45+
const entries = mapEntries
4546
.filter(({ children }) => !!children)
4647
.map(({ asyncId, created, children, domain, context = {} }) => ({
4748
asyncId,
@@ -50,10 +51,11 @@ module.exports = {
5051
contextSize: JSON.stringify(context).length,
5152
duration: getDuration(now, created),
5253
children: children.map((childId) => {
53-
const { type, created } = executionContextMap.get(childId);
54+
const { type, created } = executionContextMap.get(childId) || {};
55+
if (!type) return;
5456

5557
return { asyncId: childId, type, created, duration: getDuration(now, created) };
56-
})
58+
}).filter(Boolean)
5759
}));
5860

5961
return {

0 commit comments

Comments
 (0)