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
Stephen Belanger committed Jul 5, 2021
1 parent ccf6eef commit ad65c19
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/domain.js
Original file line number Diff line number Diff line change
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 ad65c19

Please sign in to comment.