Commit b307f20
committed
domain: port to AsyncLocalStorage
Port the domain module from createHook (async_hooks) to
AsyncLocalStorage using the AsyncContextFrame-based implementation.
Key changes:
- Use AsyncLocalStorage for domain context propagation instead of
async_hooks.createHook()
- Lazy initialization that triggers AsyncContextFrame prototype swap
on first domain use
- Use enterWith instead of ALS.run() so domain context is NOT
automatically restored on exception - this matches the original
domain.run() behavior where exit() only runs on success
- Add ERR_ASYNC_RESOURCE_DOMAIN_REMOVED error for AsyncResource.domain
- Update DEP0097 to End-of-Life status
- Remove tests that relied on the removed MakeCallback domain property
The domain module now uses the AsyncContextFrame version of
AsyncLocalStorage directly for proper context propagation across
async boundaries.1 parent 81e05e1 commit b307f20
16 files changed
Lines changed: 348 additions & 408 deletions
File tree
- doc/api
- lib
- internal
- test
- addons
- make-callback-domain-warning
- make-callback-recurse
- node-api/test_make_callback_recurse
- parallel
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2272 | 2272 | | |
2273 | 2273 | | |
2274 | 2274 | | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
2275 | 2278 | | |
2276 | 2279 | | |
2277 | 2280 | | |
2278 | 2281 | | |
2279 | 2282 | | |
2280 | | - | |
| 2283 | + | |
2281 | 2284 | | |
2282 | | - | |
2283 | | - | |
2284 | | - | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
2285 | 2289 | | |
2286 | 2290 | | |
2287 | 2291 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
710 | 710 | | |
711 | 711 | | |
712 | 712 | | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
713 | 721 | | |
714 | 722 | | |
715 | 723 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
262 | 263 | | |
263 | 264 | | |
264 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
265 | 270 | | |
266 | 271 | | |
267 | 272 | | |
| |||
0 commit comments