GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — async_hooks: remove experimental onPropagate option · nodejs/node@b1bde69

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • async_context.md
  • lib
    • async_hooks.js
  • test/async-hooks
    • test-async-local-storage-stop-propagation.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/async_context.md‎

Copy file name to clipboardExpand all lines: doc/api/async_context.md
+4-16Lines changed: 4 additions & 16 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -116,35 +116,24 @@ Each instance of `AsyncLocalStorage` maintains an independent storage context.
116116
Multiple instances can safely exist simultaneously without risk of interfering
117117
with each other's data.
118118

119-
### `new AsyncLocalStorage([options])`
119+
### `new AsyncLocalStorage()`
120120

121121
<!-- YAML
122122
added:
123123
- v13.10.0
124124
- v12.17.0
125125
changes:
126+
- version: REPLACEME
127+
pr-url: https://github.com/nodejs/node/pull/46386
128+
description: Removed experimental onPropagate option.
126129
- version: v18.13.0
127130
pr-url: https://github.com/nodejs/node/pull/45386
128131
description: Add option onPropagate.
129132
-->
130133

131-
> Stability: 1 - `options.onPropagate` is experimental.
132-
133-
* `options` {Object}
134-
* `onPropagate` {Function} Optional callback invoked before a store is
135-
propagated to a new async resource. Returning `true` allows propagation,
136-
returning `false` avoids it. Default is to propagate always.
137-
138134
Creates a new instance of `AsyncLocalStorage`. Store is only provided within a
139135
`run()` call or after an `enterWith()` call.
140136

141-
The `onPropagate` is called during creation of an async resource. Throwing at
142-
this time will print the stack trace and exit. See
143-
[`async_hooks` Error handling][] for details.
144-
145-
Creating an async resource within the `onPropagate` callback will result in
146-
a recursive call to `onPropagate`.
147-
148137
### `asyncLocalStorage.disable()`
149138

150139
<!-- YAML
@@ -830,5 +819,4 @@ const server = createServer((req, res) => {
830819
[`EventEmitter`]: events.md#class-eventemitter
831820
[`Stream`]: stream.md#stream
832821
[`Worker`]: worker_threads.md#class-worker
833-
[`async_hooks` Error handling]: async_hooks.md#error-handling
834822
[`util.promisify()`]: util.md#utilpromisifyoriginal
Collapse file

‎lib/async_hooks.js‎

Copy file name to clipboardExpand all lines: lib/async_hooks.js
+2-13Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ const {
2323
const { kEmptyObject } = require('internal/util');
2424
const {
2525
validateFunction,
26-
validateObject,
2726
validateString,
2827
} = require('internal/validators');
2928
const internal_async_hooks = require('internal/async_hooks');
@@ -275,17 +274,9 @@ const storageHook = createHook({
275274
});
276275

277276
class AsyncLocalStorage {
278-
constructor(options = kEmptyObject) {
279-
validateObject(options, 'options');
280-
281-
const { onPropagate = null } = options;
282-
if (onPropagate !== null) {
283-
validateFunction(onPropagate, 'options.onPropagate');
284-
}
285-
277+
constructor() {
286278
this.kResourceStore = Symbol('kResourceStore');
287279
this.enabled = false;
288-
this._onPropagate = onPropagate;
289280
}
290281

291282
disable() {
@@ -312,9 +303,7 @@ class AsyncLocalStorage {
312303
_propagate(resource, triggerResource, type) {
313304
const store = triggerResource[this.kResourceStore];
314305
if (this.enabled) {
315-
if (this._onPropagate === null || this._onPropagate(type, store)) {
316-
resource[this.kResourceStore] = store;
317-
}
306+
resource[this.kResourceStore] = store;
318307
}
319308
}
320309

Collapse file

‎test/async-hooks/test-async-local-storage-stop-propagation.js‎

Copy file name to clipboardExpand all lines: test/async-hooks/test-async-local-storage-stop-propagation.js
-50Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.