Skip to content

Conversation

@tomas-zijdemans
Copy link
Contributor

  • Add NaN input validation (throws TypeError)
  • Fix docs to clarify >= MAX_SAFE_INTEGER boundary
  • Skip AbortSignal.any() overhead for single-signal cases
  • Add test for NaN handling

Benchmarks show ~2.7× faster for the common timeout-only case, ~7× faster when no deadline is needed. The dual-signal path is roughly equivalent.

…rage

- Add NaN input validation with TypeError
- Fix docs: clarify MAX_SAFE_INTEGER boundary behavior
- Refactor to avoid unnecessary AbortSignal.any() when not needed
- Early return original promise when no timeout and no signal
- Add tests for: zero timeout, NaN, custom abort reason, signal priority, MAX_SAFE_INTEGER
@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

❌ Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.17%. Comparing base (0ee1ea6) to head (21eed1f).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
async/deadline.ts 89.47% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6921      +/-   ##
==========================================
- Coverage   94.18%   94.17%   -0.01%     
==========================================
  Files         584      584              
  Lines       43120    43134      +14     
  Branches     6894     6899       +5     
==========================================
+ Hits        40611    40621      +10     
- Misses       2457     2460       +3     
- Partials       52       53       +1     

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

@kt3k kt3k changed the title refactor(async): improve deadline() validation and performance fix(async): improve deadline() validation and performance Jan 5, 2026
@tomas-zijdemans
Copy link
Contributor Author

I closed this PR, since the NaN check seems overkill and the code got a bit over-engineered. Feel free to merge it if you still like it :D

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants