Repository navigation
fix(dartpad-preview): cancel embedded workers during startup - #3985
LeonMollNetlight wants to merge 1 commit into
Conversation
Create a separate abort trigger for each worker startup attempt and complete it when the runtime is suspended or closed. Preserve generation checks and protect resumed attempts from retired startup cleanup. Add browser lifecycle regression coverage. Keep the published dartpad dependency unchanged; this draft requires a release exposing dedicatedWorker(abortTrigger:). No local override is included.
PR HealthCoverage ✔️
This check for test coverage is informational (issues shown here will not fail the PR). This check can be disabled by tagging the PR with License Headers ✔️
All source files should start with a license header. Unrelated files missing license headers
This check can be disabled by tagging the PR with Breaking changes ✔️
This check can be disabled by tagging the PR with Unused Dependencies ✔️
For details on how to fix these, see dependency_validator. This check can be disabled by tagging the PR with API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
This check can be disabled by tagging the PR with Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with |
When an embedded runtime is suspended during worker startup, its native worker currently keeps initializing until the session handshake returns a DartPad client. Rapid activation of several embeds can accumulate pending workers beyond the active runtime limit.
This change gives each startup attempt a
Completer<void>and passes its future toDartPadSdk.dedicatedWorker(abortTrigger: ...). Suspension and close complete the trigger, allowing the SDK to terminate the pending worker before the handshake. Existing generation checks remain, and cleanup from a retired attempt cannot clear a resumed attempt’s trigger.Draft dependency
This PR depends on the SDK client change on LeonMollNetlight/sdk:dartpad-cancel-worker-startup, which adds
Future<void>? abortTrigger.