Skip to content

Commit

Permalink
domain: do not add domain to promise from other context
Browse files Browse the repository at this point in the history
  • Loading branch information
Qard committed Jul 5, 2021
1 parent e469ca6 commit e1e008d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/domain.js
Expand Up @@ -73,12 +73,14 @@ const asyncHook = createHook({
if (process.domain !== null && process.domain !== undefined) {
// If this operation is created while in a domain, let's mark it
pairing.set(asyncId, process.domain[kWeak]);
ObjectDefineProperty(resource, 'domain', {
configurable: true,
enumerable: false,
value: process.domain,
writable: true
});
if (type !== 'PROMISE' || resource instanceof Promise) {
ObjectDefineProperty(resource, 'domain', {
configurable: true,
enumerable: false,
value: process.domain,
writable: true
});
}
}
},
before(asyncId) {
Expand Down

0 comments on commit e1e008d

Please sign in to comment.