From bc0816595326211491ce9271441c99eeead195b2 Mon Sep 17 00:00:00 2001 From: Benjamin Gruenbaum Date: Tue, 8 Feb 2022 16:24:59 +0200 Subject: [PATCH] process: deprecate multipleResolves MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deprecate the process multipleResolves event to detect when a promise is resolved more than once because it never really worked. Fixes: https://github.com/nodejs/node/issues/41554 PR-URL: https://github.com/nodejs/node/pull/41872 Reviewed-By: Darshan Sen Reviewed-By: James M Snell Reviewed-By: Juan José Arboleda Reviewed-By: Mestery --- doc/api/deprecations.md | 14 ++++++++++++++ doc/api/process.md | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index c690a299a14f4b..d6d52e9d60c870 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -3048,6 +3048,20 @@ This method was deprecated because it is not compatible with Use [`buffer.subarray`][] which does the same thing instead. +### DEPXXXX: `process.on('multipleResolves', handler)` + + + +Type: Documentation-only + +This event was deprecated because it did not work with V8 promise combinators +which diminished its usefulness. + [Legacy URL API]: url.md#legacy-url-api [NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf [RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3 diff --git a/doc/api/process.md b/doc/api/process.md index a9efb806070630..83fc294eaff717 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -181,8 +181,11 @@ See [Advanced serialization for `child_process`][] for more details. +> Stability: 0 - Deprecated + * `type` {string} The resolution type. One of `'resolve'` or `'reject'`. * `promise` {Promise} The promise that resolved or rejected more than once. * `value` {any} The value with which the promise was either resolved or @@ -200,6 +203,9 @@ This is useful for tracking potential errors in an application while using the the occurrence of this event does not necessarily indicate an error. For example, [`Promise.race()`][] can trigger a `'multipleResolves'` event. +Because of the unreliability of the event in cases like the +[`Promise.race()`][] example above it has been deprecated. + ```mjs import process from 'process';