Repository navigation
Say where await_io_and_run() first polls its future - #8398
Conversation
The doc said the future is polled without the isolate lock and with no IoContext current. Its first poll actually runs inside the call, under the lock and with the IoContext current, because kj-rs polls a future as soon as it is added to the IoContext's task set. That matches C++: the KJ promise passed to awaitIo() has already run up to its first wait in the caller. Only the later polls run from the event loop without the lock, so the doc now says that.
There was a problem hiding this comment.
✅ Approved — A documentation-only correction to the await_io_and_run() doc. It matches the call path through io_context_await_io_and_run and awaitIoAndRun(), and I found no issues.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
📋 Code Quality: ✅ LGTM
Only doc comments in src/workerd/io/io-context/lib.rs change. The new text fits the call path: io_context_await_io_and_run gets the current IoContext, and awaitIoAndRun() requires the current context and lock, so a first poll during the call happens under the lock. The reworded Send explanation still holds, because later polls run without the lock.
📝 Documentation: ✅ LGTM
The doc wording is accurate and describes the current behaviour, as the repository's comment guidelines ask.
Reviewed commit: e3055c28
await_io_and_run()'s doc says the future is polled without the isolate lock and with noIoContextcurrent. Its first poll actually runs inside the call, under the lock and with the request current, because kj-rs polls a future as soon as it is added to the task set (FuturePollEvent::onReady).await_ioandawait_io_valueinherit the same doc.This matches C++, where the KJ promise passed to
awaitIo()has already run up to its first wait in the caller. In this patch the doc says the first poll happens in the call and only later polls run from the event loop without the lock. Doc only, no behaviour change.