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

Function trackPromise

lib/internal/async_hooks.js:315–327  ·  view source on GitHub ↗
(promise, parent)

Source from the content-addressed store, hash-verified

313}
314
315function trackPromise(promise, parent) {
316 if (promise[async_id_symbol]) {
317 return;
318 }
319
320 // Get trigger id from parent async id before making the async id of the
321 // child so if a new one must be made it will be lower than the child.
322 const triggerAsyncId = parent ? getOrSetAsyncId(parent) :
323 getDefaultTriggerAsyncId();
324
325 promise[async_id_symbol] = newAsyncId();
326 promise[trigger_async_id_symbol] = triggerAsyncId;
327}
328
329function promiseInitHook(promise, parent) {
330 trackPromise(promise, parent);

Callers 5

promiseInitHookFunction · 0.85
destroyTrackingFunction · 0.85
promiseBeforeHookFunction · 0.85
promiseAfterHookFunction · 0.85
promiseResolveHookFunction · 0.85

Calls 3

getOrSetAsyncIdFunction · 0.85
getDefaultTriggerAsyncIdFunction · 0.85
newAsyncIdFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…