Repository navigation
docs: a cold Async starts at the await, so overlap goes through Async.parallel - #179
Merged
Merged
Conversation
….parallel Since #177 an extern whose Python call starts work at once (an asyncio Task, a JS promise) starts it at the await instead. Two such calls bound with let and awaited afterwards used to overlap and now run one after the other, and awaiting one twice makes the call twice. Checked against the 0.9.0 wheel: the same program started both at 0.0s there and the second at 0.5s now, while Async.parallel overlapped under both. DESIGN §8 and the Pyodide passage say so, and lesson 18 tells the reader to use Async.parallel for overlap.
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.
Follow-up to #177. An extern whose Python call starts work at once (a call returning an
asyncioTask, or a JS promise under Pyodide) now starts that work at the await.So this pattern, which used to overlap the two requests, now runs them one after the other:
Awaiting one value twice also makes the call twice. I checked this against the 0.9.0 wheel with a Python
fetchthat returns anasyncioTask. Under 0.9.0 both requests started at 0.0s; onmainthe second starts at 0.5s.Async.paralleloverlapped under both.Nothing fails, so this is easy to miss. DESIGN §8 and the Pyodide passage now say it, and lesson 18 tells the reader to hand work to
Async.parallelwhen it should overlap. The notebook is regenerated, andverify_lessons.pypasses. The 0.10.0 release notes draft says the same.