DEP0098: AsyncHooks 嵌入器 AsyncResource.emitBefore 和 AsyncResource.emitAfter API


类型: 生命结束

Type: End-of-Life

The embedded API provided by AsyncHooks exposes .emitBefore() and .emitAfter() methods which are very easy to use incorrectly which can lead to unrecoverable errors.

Use asyncResource.runInAsyncScope() API instead which provides a much safer, and more convenient, alternative. See https://github.com/nodejs/node/pull/18513.