Commit 796ff46
async_hooks: add trackPromises option to createHook()
This adds a trackPromises option that allows users to completely opt
out of the promise hooks that are installed whenever an async hook is
added. For those who do not need to track promises, this avoids
the excessive hook invocation and the heavy overhead from it.
This option was previously already implemented internally to skip the
noise from promise hooks when debugging async operations via the
V8 inspector. This patch just exposes it.
PR-URL: #61415
Refs: #57148
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>1 parent 8f2083e commit 796ff46Copy full SHA for 796ff46
9 files changed
+145-9Lines changed: 145 additions & 9 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- doc/api
- lib
- internal
- test/async-hooks
- tools/doc
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+39-4Lines changed: 39 additions & 4 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
144 | 144 | |
145 | 145 | |
146 | 146 | |
147 | | - |
| 147 | + |
148 | 148 | |
149 | 149 | |
150 | 150 | |
151 | 151 | |
152 | 152 | |
153 | | - |
| 153 | + |
154 | 154 | |
155 | 155 | |
156 | 156 | |
157 | 157 | |
158 | 158 | |
| 159 | + |
| 160 | + |
159 | 161 | |
160 | 162 | |
161 | 163 | |
| ||
354 | 356 | |
355 | 357 | |
356 | 358 | |
357 | | - |
| 359 | + |
| 360 | + |
358 | 361 | |
359 | 362 | |
360 | 363 | |
| ||
910 | 913 | |
911 | 914 | |
912 | 915 | |
| 916 | + |
| 917 | + |
| 918 | + |
| 919 | + |
| 920 | + |
| 921 | + |
| 922 | + |
| 923 | + |
| 924 | + |
| 925 | + |
| 926 | + |
| 927 | + |
| 928 | + |
| 929 | + |
| 930 | + |
| 931 | + |
| 932 | + |
| 933 | + |
| 934 | + |
| 935 | + |
| 936 | + |
| 937 | + |
| 938 | + |
| 939 | + |
| 940 | + |
| 941 | + |
| 942 | + |
| 943 | + |
| 944 | + |
| 945 | + |
| 946 | + |
| 947 | + |
913 | 948 | |
914 | 949 | |
915 | 950 | |
| ||
934 | 969 | |
935 | 970 | |
936 | 971 | |
937 | | - |
| 972 | + |
938 | 973 | |
939 | 974 | |
940 | 975 | |
|
Collapse file
+16-2Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
18 | 18 | |
19 | 19 | |
20 | 20 | |
| 21 | + |
| 22 | + |
21 | 23 | |
22 | 24 | |
23 | 25 | |
| ||
71 | 73 | |
72 | 74 | |
73 | 75 | |
74 | | - |
| 76 | + |
75 | 77 | |
76 | 78 | |
77 | 79 | |
| ||
82 | 84 | |
83 | 85 | |
84 | 86 | |
| 87 | + |
| 88 | + |
| 89 | + |
85 | 90 | |
86 | 91 | |
87 | 92 | |
88 | 93 | |
89 | 94 | |
90 | 95 | |
91 | | - |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
92 | 106 | |
93 | 107 | |
94 | 108 | |
|
Collapse file
lib/internal/inspector_async_hook.js
Copy file name to clipboardExpand all lines: lib/internal/inspector_async_hook.js+1-2Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
7 | 7 | |
8 | 8 | |
9 | 9 | |
10 | | - |
11 | 10 | |
12 | 11 | |
13 | 12 | |
| ||
30 | 29 | |
31 | 30 | |
32 | 31 | |
| 32 | + |
33 | 33 | |
34 | | - |
35 | 34 | |
36 | 35 | |
37 | 36 | |
|
Collapse file
test/async-hooks/test-track-promises-default.js
Copy file name to clipboard+16Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
Collapse file
test/async-hooks/test-track-promises-false-check.js
Copy file name to clipboard+19Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
Collapse file
test/async-hooks/test-track-promises-false.js
Copy file name to clipboard+11Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
Collapse file
test/async-hooks/test-track-promises-true.js
Copy file name to clipboard+17Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
Collapse file
test/async-hooks/test-track-promises-validation.js
Copy file name to clipboard+25Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
Collapse file
+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
66 | 66 | |
67 | 67 | |
68 | 68 | |
69 | | - |
| 69 | + |
70 | 70 | |
71 | 71 | |
72 | 72 | |
|
0 commit comments