Jeff-Lewis / cls-hooked

cls-hooked : CLS using AsynWrap or async_hooks instead of async-listener for node 4.7+
BSD 2-Clause "Simplified" License
758 stars 89 forks source link

Discussion: Porting to nodejs AsyncLocalStorage #57

Open Ghost---Shadow opened 4 years ago

Ghost---Shadow commented 4 years ago

Since node 13 AsyncLocalStorage has been added.

https://nodejs.org/api/async_hooks.html#async_hooks_class_asynclocalstorage

I think we should port to that.

The API looks fairly clean.

kylemillar608 commented 3 years ago

Are there any plans to do this? https://github.com/nodejs/node/issues/35286 - seems like this API is much closer to being stable than Async Hooks.

SimonX200 commented 3 years ago

For our project the plain AsyncLocalStorage is enough.

To me it looks like the porting is only useful to keep the cls-hooked API and have an updated npm package to existing projects.

I think actually that the porting will result in just a wrapping of AsyncLocalStorage methods to the cls-hook api names.

m0uneer commented 2 years ago

And why not @SimonX200?