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

Clarify example for AsyncResource #1517

Closed
daprahamian opened this issue Sep 23, 2018 · 10 comments
Closed

Clarify example for AsyncResource #1517

daprahamian opened this issue Sep 23, 2018 · 10 comments

Comments

@daprahamian
Copy link

  • Node.js Version: 10
  • OS: N/A
  • Scope (install, code, runtime, meta, other?): ?Documentation
  • Module (and version) (if relevant): async_hooks

Hi there,

Can someone clarify the purpose of the new AsyncResource class? The example provided doesn't seem to show why it is beneficial.

Thanks,
Dan

@gireeshpunathil
Copy link
Member

ping @nodejs/async_hooks

@dko-slapdash
Copy link

+1

@gireeshpunathil
Copy link
Member

pinging @addaleax to see if a short description can be provided here. I can attempt, but cannot guarantee its correctness.

@gajus
Copy link

gajus commented Nov 16, 2019

Similarly, worker_threads documentation is [suggesting to use AsyncResource], but there is no example of how:

When implementing a worker pool, use the AsyncResource API to inform diagnostic tools (e.g. in order to provide asynchronous stack traces) about the correlation between tasks and their outcomes.

@pioardi
Copy link

pioardi commented Jan 19, 2020

I implemented a thread pool with worker_thread module , but is not clear how use AsyncResource on it .

+1

@gireeshpunathil
Copy link
Member

@daprahamian - pls review nodejs/node#31601 and see if that helps you

@pioardi
Copy link

pioardi commented Feb 1, 2020

@gireeshpunathil yes I will review the PR today or tomorrow and will give a feedback on that , thanks !!!

@pioardi
Copy link

pioardi commented Feb 2, 2020

@gireeshpunathil I reviewed the PR , the example is clear and contains more details than expected ( error handling , wait a free worker, etc... ) :) .

Thanks !!!

@daprahamian
Copy link
Author

@gireeshpunathil I looked it over, and the example looks good to me, and definitely clears up usage. Thanks!

@gireeshpunathil
Copy link
Member

closing this as nodejs/node#31601 has landed that covers this.

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

No branches or pull requests

5 participants