MCPcopy Index your code
hub / github.com/nodejs/node / recurse

Function recurse

test/parallel/test-async-hooks-recursive-stack-runInAsyncScope.js:8–18  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

6// This test verifies that the async ID stack can grow indefinitely.
7
8function recurse(n) {
9 const a = new async_hooks.AsyncResource('foobar');
10 a.runInAsyncScope(common.mustCall(() => {
11 assert.strictEqual(a.asyncId(), async_hooks.executionAsyncId());
12 assert.strictEqual(a.triggerAsyncId(), async_hooks.triggerAsyncId());
13 if (n >= 0)
14 recurse(n - 1);
15 assert.strictEqual(a.asyncId(), async_hooks.executionAsyncId());
16 assert.strictEqual(a.triggerAsyncId(), async_hooks.triggerAsyncId());
17 }));
18}
19
20recurse(1000);

Calls 3

runInAsyncScopeMethod · 0.95
asyncIdMethod · 0.95
triggerAsyncIdMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…