doc: fix minor issues in async_hooks.md
* easily -> easy * was -> is * add a missing comma PR-URL: https://github.com/nodejs/node/pull/19313 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
8d336dd8b1
commit
e5e0f9f3a8
@ -147,10 +147,10 @@ unintentional side effects.
|
||||
Because printing to the console is an asynchronous operation, `console.log()`
|
||||
will cause the AsyncHooks callbacks to be called. Using `console.log()` or
|
||||
similar asynchronous operations inside an AsyncHooks callback function will thus
|
||||
cause an infinite recursion. An easily solution to this when debugging is
|
||||
to use a synchronous logging operation such as `fs.writeSync(1, msg)`. This
|
||||
will print to stdout because `1` is the file descriptor for stdout and will
|
||||
not invoke AsyncHooks recursively because it is synchronous.
|
||||
cause an infinite recursion. An easy solution to this when debugging is to use a
|
||||
synchronous logging operation such as `fs.writeSync(1, msg)`. This will print to
|
||||
stdout because `1` is the file descriptor for stdout and will not invoke
|
||||
AsyncHooks recursively because it is synchronous.
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
@ -585,8 +585,8 @@ like I/O, connection pooling, or managing callback queues may use the
|
||||
|
||||
### `class AsyncResource()`
|
||||
|
||||
The class `AsyncResource` was designed to be extended by the embedder's async
|
||||
resources. Using this users can easily trigger the lifetime events of their
|
||||
The class `AsyncResource` is designed to be extended by the embedder's async
|
||||
resources. Using this, users can easily trigger the lifetime events of their
|
||||
own resources.
|
||||
|
||||
The `init` hook will trigger when an `AsyncResource` is instantiated.
|
||||
|
Loading…
x
Reference in New Issue
Block a user