Skip to content

docs: a cold Async starts at the await, so overlap goes through Async.parallel - #179

Merged
simontreanor merged 1 commit into
mainfrom
docs-cold-async-overlap
Oct 17, 2026
Merged

simontreanor merged 1 commit into
mainfrom
docs-cold-async-overlap

Conversation

@simontreanor

Copy link
Copy Markdown
Owner

Follow-up to #177. An extern whose Python call starts work at once (a call returning an asyncio Task, 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:

let a = fetch url1
let b = fetch url2
let! x = a
let! y = b

Awaiting one value twice also makes the call twice. I checked this against the 0.9.0 wheel with a Python fetch that returns an asyncio Task. Under 0.9.0 both requests started at 0.0s; on main the second starts at 0.5s. Async.parallel overlapped 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.parallel when it should overlap. The notebook is regenerated, and verify_lessons.py passes. The 0.10.0 release notes draft says the same.

….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.
@simontreanor
simontreanor merged commit b56e410 into main Oct 17, 2026
22 checks passed
@simontreanor
simontreanor deleted the docs-cold-async-overlap branch October 17, 2026 23:22
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.

1 participant