Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Sequential semantics of async DisposeResources #3

@zloirock

Description

@zloirock
const d = new AsyncDisposableStack();
d.defer(async () => console.log(44));
d.defer(async () => console.log(43));
d.defer(() => new Promise(resolve => setTimeout(() => {
  console.log(42);
  resolve();
}, 1e4)));
await d.disposeAsync();
// only after 10 seconds: 42, 43, 44

That looks strange - why are some resources that can be disposed immediately should wait for something if it can be done in parallel? In case of errors, the tree can be built in the end. However, yes, here is stack in the name...

Metadata

Metadata

Assignees

No one assigned

    Labels

    for follow-on proposalThis issue should be investigated for a follow-on proposal.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions