Skip to content

Comments

Implement Symbol.asyncDispose for better DX in short lived processes#332

Merged
mcollina merged 8 commits intofastify:mainfrom
arthurfiorette:main
Feb 12, 2026
Merged

Implement Symbol.asyncDispose for better DX in short lived processes#332
mcollina merged 8 commits intofastify:mainfrom
arthurfiorette:main

Conversation

@arthurfiorette
Copy link
Contributor

@arthurfiorette arthurfiorette commented Feb 11, 2026

This pull request adds support for the ECMAScript Explicit Resource Management proposal by implementing the Symbol.asyncDispose method on the main application instance. This allows users to automatically clean up resources using the await using syntax in Node.js 20 and later. The documentation has been updated to explain the new feature, and a test has been added to ensure correct behavior.

This PR is similar to this one merged in Fastify ~2 years ago.

Checklist

Copilot AI and others added 8 commits February 10, 2026 19:20
Co-authored-by: arthurfiorette <47537704+arthurfiorette@users.noreply.github.com>
Co-authored-by: arthurfiorette <47537704+arthurfiorette@users.noreply.github.com>
… use await using syntax in test

Co-authored-by: arthurfiorette <47537704+arthurfiorette@users.noreply.github.com>
…ncDispose call

Co-authored-by: arthurfiorette <47537704+arthurfiorette@users.noreply.github.com>
Co-authored-by: arthurfiorette <47537704+arthurfiorette@users.noreply.github.com>
Signed-off-by: Arthur Fiorette <47537704+arthurfiorette@users.noreply.github.com>
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit a9963ed into fastify:main Feb 12, 2026
14 checks passed
@arthurfiorette
Copy link
Contributor Author

@mcollina can you release a new version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants