Skip to content

Conversation

@OrbisK
Copy link
Contributor

@OrbisK OrbisK commented Aug 4, 2025

This PR uses a AbortSignal.timeout() merged with an optional options.signal with AbortSignal.any()

resolves #326

This should make the following obsolete: #481.

@OrbisK
Copy link
Contributor Author

OrbisK commented Aug 4, 2025

cc @kricsleo wdyt? I think we dont need to use the custom AbortController, we should be able to only use the signal 😄

@kricsleo
Copy link
Member

kricsleo commented Aug 5, 2025

I'm not using these APIs just for compatibility reasons; AbortSignal.timeout() is available in Chrome 124+, and AbortSignal.any is available in Node.js 20.3+. This seems too strict.

@OrbisK
Copy link
Contributor Author

OrbisK commented Aug 5, 2025

AbortSignal.timeout() is available in Chrome 124+

Actually it is Chrome 103+, but with AbortError instead of Timeout Error. But you are right AbortSignal.any is Chrome 116+ 🤔

@pi0
Copy link
Member

pi0 commented Aug 29, 2025

Both are available in latest baseline which is good. However we could do better with backward compat and introduce new API requirements in a major.

  • If there is only one signal, we don't need AbortSignal.any wrapper
    -AbortSignal.timeout is not always required.

@codecov
Copy link

codecov bot commented Aug 30, 2025

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.17%. Comparing base (27996d3) to head (5be353a).
⚠️ Report is 90 commits behind head on main.

Files with missing lines Patch % Lines
src/fetch.ts 75.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #508       +/-   ##
===========================================
+ Coverage   56.86%   93.17%   +36.30%     
===========================================
  Files          16        4       -12     
  Lines         728      205      -523     
  Branches      113      110        -3     
===========================================
- Hits          414      191      -223     
+ Misses        303       14      -289     
+ Partials       11        0       -11     

☔ 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.

@OrbisK
Copy link
Contributor Author

OrbisK commented Aug 30, 2025

like this?

@pi0 pi0 changed the title feat: support custom AbortSignal with timeout feat!: support custom AbortSignal with timeout Oct 28, 2025
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

Thanks! Since now targetting v2, i have updated to use simpler Abortsignal.timeout 👍🏼

@pi0 pi0 merged commit 3cf498b into unjs:main Oct 28, 2025
6 checks passed
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.

Support custom Abortcontroller with timeout

3 participants