Repository navigation
doc: add note about AsyncResource for Worker pooling #28023
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -48,6 +48,9 @@ if (isMainThread) { | |||||
| The above example spawns a Worker thread for each `parse()` call. In actual | ||||||
| practice, use a pool of Workers instead for these kinds of tasks. Otherwise, the | ||||||
| overhead of creating Workers would likely exceed their benefit. | ||||||
| When implementing a worker pool, it is strongly recommended to use the | ||||||
| [`AsyncResource`][] API to inform diagnostic tools (for e.g. asynchronous stack | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo:
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Trott I don’t think
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's great.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Total ignorable nit: Maybe drop "in order"?) |
||||||
| traces) about the correlation between tasks and their outcomes. | ||||||
|
|
||||||
| ## worker.isMainThread | ||||||
| <!-- YAML | ||||||
|
|
@@ -653,6 +656,7 @@ active handle in the event system. If the worker is already `unref()`ed calling | |||||
| `unref()` again will have no effect. | ||||||
|
|
||||||
| [`'close'` event]: #worker_threads_event_close | ||||||
| [`AsyncResource`]: async_hooks.html#async_hooks_class_asyncresource | ||||||
| [`Buffer`]: buffer.html | ||||||
| [`EventEmitter`]: events.html | ||||||
| [`EventTarget`]: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.