You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Explicit resource management for AsyncLocalStorage #58651
Does it make sense to add a method to AsyncLocalStorage that returns Disposable?
What is the feature you are proposing to solve the problem?
This is the example from AsyncLocalStorage using .run, which introduces a callback and a level of nesting that comes with that.
http.createServer((req,res)=>{asyncLocalStorage.run(idSeq++,()=>{logWithId('start');// Imagine any chain of async operations heresetImmediate(()=>{logWithId('finish');res.end();});});})
With with explicit resource management this could be:
http.createServer((req,res)=>{
using _id=asyncLocalStorage._PROPOSED(idSeq++)logWithId('start');// Imagine any chain of async operations heresetImmediate(()=>{logWithId('finish');res.end();});})
enterWith currently returns undefined, could that be updated to return a Disposable?
Activity
jasnell commentedon Jun 9, 2025
Already in progress: #58104 @bengl
everett1992 commentedon Jun 9, 2025
Nice - I searched but I guess not in PRs