Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for AsyncLocalStorage? #22

Closed
natoszme opened this issue Dec 12, 2022 · 5 comments · Fixed by #39
Closed

Support for AsyncLocalStorage? #22

natoszme opened this issue Dec 12, 2022 · 5 comments · Fixed by #39
Assignees
Labels
enhancement New feature or request

Comments

@natoszme
Copy link

Hi there!

First of all, thanks for this implementation, seems really cool!
I'm about to start a project using Nest and this was the best library I found for transaction management. The only thing stopping me from using it is the fact that cls-hooked uses async_hooks under the hood, which is considered unstable:

Stability: 1 - Experimental. Please migrate away from this API, if you can. We do not recommend using the createHook, AsyncHook, and executionAsyncResource APIs as they have usability issues, safety risks, and performance implications. Async context tracking use cases are better served by the stable AsyncLocalStorage API.

Is there any plan to migrate from cls-hooked to native's AsyncLocalStorage? I think it'd be an amazing stability improvement for this library.
In fact there is this implementation for resolving quite the same problem (but without maintenance).

Thank you for your work!

@Aliheym
Copy link
Owner

Aliheym commented Dec 15, 2022

Hi, I think that's a great idea. I've figured out AsyncLocalStorage more and I really like it. I think it would be a good idea to use it and drop the cls-hooked dependency. Thanks for this point.

The only thing I'm worried about is that now we'll have to stop to support some versions of Node.js.

@Aliheym Aliheym added the enhancement New feature or request label Dec 15, 2022
@Aliheym Aliheym self-assigned this Dec 15, 2022
@natoszme
Copy link
Author

I know that it may not be so simple, but something similar to what cls-hooked does may be done (using cls-hooked for node < 16, AsyncLocalStorage for node >= 16)

@natoszme
Copy link
Author

natoszme commented Mar 6, 2023

hi there! @Aliheym are there any plans to implement this one? thanks!

@Aliheym
Copy link
Owner

Aliheym commented Mar 6, 2023

hi there! @Aliheym are there any plans to implement this one? thanks!

Hi, yes. I am planning to start to implement it on this week. 🙂

@ahmedkoshek
Copy link

Hi @Aliheym, any updates on supporting AsyncLocalStorage.
The only thing stopping me from using it is the fact that cls-hooked uses async_hooks under the hood, which is considered unstable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants