@@ -4,7 +4,7 @@ const assert = require('assert');
44
55const http = require ( 'http' ) ;
66const { AsyncLocalStorage } = require ( 'async_hooks' ) ;
7- const als = new AsyncLocalStorage ( ) ;
7+ const asyncLocalStorage = new AsyncLocalStorage ( ) ;
88
99const maxSize = 1024 ;
1010
@@ -19,10 +19,10 @@ const server = http.createServer(common.mustCall((req, res) => {
1919} ) ) ;
2020
2121server . listen ( 0 , ( ) => {
22- als . run ( new Map ( ) , common . mustCall ( ( ) => {
22+ asyncLocalStorage . run ( new Map ( ) , common . mustCall ( ( ) => {
2323 const options = { port : server . address ( ) . port } ;
2424 const req = http . get ( options , common . mustCall ( ( res ) => {
25- const store = als . getStore ( ) ;
25+ const store = asyncLocalStorage . getStore ( ) ;
2626 store . set ( 'req' , req ) ;
2727 store . set ( 'size' , 0 ) ;
2828 res . on ( 'data' , ondata ) ;
@@ -33,7 +33,7 @@ server.listen(0, () => {
3333} ) ;
3434
3535function ondata ( d ) {
36- const store = als . getStore ( ) ;
36+ const store = asyncLocalStorage . getStore ( ) ;
3737 const req = store . get ( 'req' ) ;
3838 let size = store . get ( 'size' ) ;
3939 size += d . length ;
@@ -47,7 +47,7 @@ function ondata(d) {
4747}
4848
4949function onabort ( ) {
50- const store = als . getStore ( ) ;
50+ const store = asyncLocalStorage . getStore ( ) ;
5151 const size = store . get ( 'size' ) ;
5252 assert . strictEqual ( size , maxSize ) ;
5353}
0 commit comments