Skip to content

Commit ad65c19

Browse files
author
Stephen Belanger
committed
domain: do not add domain to promise from other context
1 parent ccf6eef commit ad65c19

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/domain.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,14 @@ const asyncHook = createHook({
7373
if (process.domain !== null && process.domain !== undefined) {
7474
// If this operation is created while in a domain, let's mark it
7575
pairing.set(asyncId, process.domain[kWeak]);
76-
ObjectDefineProperty(resource, 'domain', {
77-
configurable: true,
78-
enumerable: false,
79-
value: process.domain,
80-
writable: true
81-
});
76+
if (type !== 'PROMISE' || resource instanceof Promise) {
77+
ObjectDefineProperty(resource, 'domain', {
78+
configurable: true,
79+
enumerable: false,
80+
value: process.domain,
81+
writable: true
82+
});
83+
}
8284
}
8385
},
8486
before(asyncId) {

0 commit comments

Comments
 (0)