refactor(microtask): setTimeout used instead of microtask queue for promise resolution #503#514
Merged
Conversation
nev21
commented
May 30, 2026
Contributor
- timeout=0/default path uses microtask scheduling (scheduleMicrotask)
- explicit timeout>0 continues to use setTimeout(timeout)
- fake-timer compatibility path remains setTimeout(0) for deterministic tests
There was a problem hiding this comment.
Pull request overview
This PR refactors asynchronous promise continuation scheduling so default/zero-timeout resolution uses microtasks while preserving delayed scheduling for positive timeout values and fake-timer compatibility.
Changes:
- Adds microtask-based scheduling to
timeoutItemProcessor. - Introduces timeout normalization for direct and chained promise extra arguments.
- Adds a focused microtask timing test and updates dependency lockfiles for
@nevware21/ts-utils.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
package.json |
Bumps @nevware21/ts-utils minimum version. |
lib/package.json |
Bumps published package runtime dependency on @nevware21/ts-utils. |
common/config/rush/npm-shrinkwrap.json |
Refreshes locked dependency graph. |
lib/src/internal/timeout_helpers.ts |
Adds shared timeout normalization helper. |
lib/src/promise/itemProcessor.ts |
Switches default async scheduling to microtasks and keeps timeout/fake-timer paths. |
lib/src/promise/idlePromise.ts |
Uses shared timeout normalization for idle promises. |
lib/test/src/promise/async.microtask.promise.test.ts |
Adds coverage for default microtask timing. |
Files not reviewed (1)
- common/config/rush/npm-shrinkwrap.json: Language not supported
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #514 +/- ##
==========================================
+ Coverage 97.49% 97.57% +0.07%
==========================================
Files 27 28 +1
Lines 1438 1484 +46
Branches 337 350 +13
==========================================
+ Hits 1402 1448 +46
Misses 36 36
🚀 New features to boost your workflow:
|
…romise resolution #503 - timeout=0/default path uses microtask scheduling (scheduleMicrotask) - explicit timeout>0 continues to use setTimeout(timeout) - fake-timer compatibility path remains setTimeout(0) for deterministic tests
nevware21-bot
approved these changes
May 30, 2026
nevware21-bot
left a comment
Contributor
There was a problem hiding this comment.
Approved by nevware21-bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.