-
-
Notifications
You must be signed in to change notification settings - Fork 255
[SPIKE] settled(): await settledness instead of polling for it #1574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
NullVoxPopuli-ai-agent
wants to merge
4
commits into
emberjs:master
Choose a base branch
from
NullVoxPopuli-ai-agent:settled-awaits-render-settled
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+49
−12
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
06251b8
settled() awaits renderSettled() instead of polling the render half
NullVoxPopuli-ai-agent ed7c7b8
Bridge render settledness edges into a test waiter
NullVoxPopuli-ai-agent 39b0024
Await settledness instead of polling for it
NullVoxPopuli-ai-agent 4da40d2
Inline the settle helpers; keep the timers that are load-bearing
NullVoxPopuli-ai-agent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad bot. this is not what I meant.
I meant in the test-waiters package, when we go beginAsync, we can have that be internally new Promise, and then endAsync resolves the promise.
test-waiters can have a waitersSettled() function which sees if all known promises are resolved (tho, if they resolve, I would also assume they remove themselves from the structure that waitersSettled() would look at)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, and you're right — I built the aggregate version (one module-level deferred that resolved when
hasPendingWaiters()went false), not per-operation promises. Redone as you described, in emberjs/ember-test-waiters#525:beginAsynccreates a promise for that operationendAsyncresolves it and deletes it from the pending map, so the map only ever holds work in flightwaitersSettled()composes the promises of what's currently tracked, via a new optionalsettled()on each waiterYour design is also strictly better than mine for a reason I hadn't considered: my version called
hasPendingWaiters()on everyendAsync, which walks every registered waiter and buildsdebugInfoarrays for the pending ones. Per-operation promises do no scanning at all —endAsyncresolves one deferred.One case the interface forced a decision on: a
Waiterimplemented directly against the interface has nosettled()to compose. Rather than reporting a quiet it can't verify,waitersSettled()returns a never-resolving promise while such a waiter is pending, so the caller's fallback tick drives and pull-only waiters keep working.Re-validated: test-waiters
base-tests56/56; this repo's test-app 553/553 both against a linked build of the new API and against published test-waiters (degraded to the fallback); limber's full chrome matrix green with 7/7 repeat runs against the runloop-less spike.