Skip to content

Commit

Permalink
process: deprecate multipleResolves
Browse files Browse the repository at this point in the history
Deprecate the process multipleResolves event to detect when a promise is
resolved more than once because it never really worked.

Fixes: nodejs#41554

PR-URL: nodejs#41872
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Mestery <[email protected]>
  • Loading branch information
benjamingr authored and bengl committed Feb 21, 2022
1 parent 0fff4d2 commit 5796c3a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -3061,6 +3061,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)`

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41872
description: Documentation-only deprecation.
-->

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
Expand Down
6 changes: 6 additions & 0 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,11 @@ See [Advanced serialization for `child_process`][] for more details.

<!-- YAML
added: v10.12.0
deprecated: REPLACEME
-->

> 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
Expand All @@ -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';

Expand Down

0 comments on commit 5796c3a

Please sign in to comment.