We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
18, 20, 22
macos
async_hooks
import { AsyncLocalStorage } from 'node:async_hooks' const als = new AsyncLocalStorage() const iter = als.run(10, function * () { yield 1 + (als.getStore() ?? 0) yield 2 + (als.getStore() ?? 0) }) for await (const value of iter) { console.log(value) } const changed = als.run(10, function () { const iter = AsyncLocalStorage.bind(function * () { yield 1 + (als.getStore() ?? 0) yield 2 + (als.getStore() ?? 0) })() iter[Symbol.iterator] = AsyncLocalStorage.bind(iter[Symbol.iterator]) return iter; }) for (const value of changed) { console.log(value) }
No response
11 12 11 12
1 2 1 2
The text was updated successfully, but these errors were encountered:
workaround:
const changed = als.run(10, function () { const iter = function * () { yield 1 + (als.getStore() ?? 0) yield 2 + (als.getStore() ?? 0) } const sp = AsyncLocalStorage.snapshot(); return function * () { const f = iter() while (true) { const { value, done } = sp(() => f.next()) if (done) { break } yield value } }() })
Sorry, something went wrong.
event.reason
parentEvent
This feels like a dupe of #42237.
No branches or pull requests
Version
18, 20, 22
Platform
macos
Subsystem
async_hooks
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior? Why is that the expected behavior?
What do you see instead?
Additional information
No response
The text was updated successfully, but these errors were encountered: