refactor(net)!: drive time and cache cleanup explicitly - #3825
Merged
Merged
Conversation
Replace the spawning Runtime trait with caller-owned session drivers and independent timer providers. Update runtime integrations, tests, and documentation. Co-Authored-By: GPT-6 <noreply@openai.com>
Supply time when polling session and origin drivers, move runtime sleeping into adapters, and expose Pool::gc for approximate idle cleanup. Co-Authored-By: GPT-6 <noreply@openai.com>
Restore the original datagram write signatures and bound Rust and JavaScript datagram send buffers to the newest 64 entries without clock reads. Co-Authored-By: GPT-6 <noreply@openai.com>
Adapt the test to the catalog constructor from main so workspace validation compiles. Co-Authored-By: GPT-6 <noreply@openai.com>
kixelated
marked this pull request as ready for review
September 21, 2026 10:21
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
This was referenced Sep 21, 2026
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.

Problem
Session and origin drivers still depend on runtime timer providers, and cache accesses read ambient time. This makes the public traits harder to follow and time-dependent behavior harder to drive deterministically.
Approach
Supply
Instantwhen polling drivers and let runtime adapters sleep until the driver's next deadline. Replace timer generics with a private driver clock. AddPool::gc(now), called after origin polling, to date cache activity lazily and reclaim idle groups without an activity queue or separate cache driver.Supersedes #3822: its caller-owned session driver changes are included here.
Impact
Instantand return(Session, Driver); drivers are explicitly polled rather than awaited directly.time::Driverwithpoll(now, waiter)andtimeout(). Public runtime/timer-provider traits and timer generics are removed.Pool::gc(now) -> Option<Instant>exposes standalone cleanup. Origins include its deadline in their own timeout. Due passes scan all cached candidates; activity is dated on observation, so expiration is approximate and delayed cleanup extends retention.moq-netdoes not spawn tasks.moq_tokio::origin::spawn()/spawn_config(config)keep the shape from feat(net)!: simplify origin scoping #3804.Validation
just checkandjust testpass after merging currentmain(noq-only backend, origin scoping, embedding API changes).Alternatives
Passing an instant through every frame access would make expiration more precise but widen the API. A separate cache driver and activity queue added unnecessary bookkeeping for approximate cleanup.
Follow-ups
run(driver)adapter loop is copied inmoq-tokio,moq-wasm,moq-ffi,moq-uring, andmoq_net::time::test; a sharedweb_async-backed helper could replace four of them.Poll<Output>plustimeout()is kept becauseResult<Option<Instant>>alone cannot express a live driver waiting only on external activity.smoke-full, unrelated to this PR).(written by GPT-6, taken over by Claude Opus 5)
🤖 Generated with Claude Code