Skip to content

chore: use native addAbortListener#5021

Merged
mcollina merged 1 commit intonodejs:mainfrom
trivikr:add-abort-listener
Apr 13, 2026
Merged

chore: use native addAbortListener#5021
mcollina merged 1 commit intonodejs:mainfrom
trivikr:add-abort-listener

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented Apr 12, 2026

This relates to...

https://nodejs.org/api/events.html#eventsaddabortlistenersignal-listener

Rationale

Node now provides a native events.addAbortListener() for real AbortSignal instances

This change switches the internal AbortSignal paths over to the native helper while preserving Undici's existing fallback behavior for EventEmitter-style signals.

Changes

  • use node:events' native addAbortListener() in BodyReadable.dump() and WebSocketStream
  • update lib/core/util.addAbortListener() to delegate to the native helper for AbortSignal instances while keeping the existing addEventListener/once fallback paths

Features

N/A

Bug Fixes

N/A

Breaking Changes and Deprecations

N/A

Status

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.93%. Comparing base (8cfb762) to head (de15b4e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5021   +/-   ##
=======================================
  Coverage   92.92%   92.93%           
=======================================
  Files         110      110           
  Lines       35740    35747    +7     
=======================================
+ Hits        33213    33220    +7     
  Misses       2527     2527           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
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 6824eed into nodejs:main Apr 13, 2026
36 checks passed
@trivikr trivikr deleted the add-abort-listener branch April 13, 2026 14:19
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