fix(cli): prevent hot reload server from pinning a CPU core (#816)#825
fix(cli): prevent hot reload server from pinning a CPU core (#816)#825lewinpauli wants to merge 1 commit into
Conversation
…#816) The generated server_target.dart created the HotReloader with `debounceInterval: Duration.zero`. hotreloader reuses that value as the `pollingDelay` for any watcher that falls back to polling — notably for paths that don't exist, such as an unused `bin/` or `test/` directory. With a zero delay this turns into a tight busy loop that pins a CPU core to 100% even while idle, on every platform. - Use a non-zero `debounceInterval` (200ms) so any polling fallback no longer busy-loops. This alone fixes the reported issue. - Additionally pass `excludedPaths` for `bin`/`test` when those folders are absent, so no polling watcher is created for them in the first place.
|
To preview the documentation for this pull request, visit the following URL:
|
Package Version ReportThe following packages have been updated: |
|
Thanks for this fix. Regarding excludePaths, the hotreloader docs say:
So we would have to have a more complex setup for these paths to detect if jaspr is run in a workspace or not. To avoid that let's just drop the excluded paths, since you said the debounce duration already fixes it. I'm also ok with setting this higher, e.g. 1 second which is the default value. |
Description
jaspr servepins a CPU core at 100% even while completely idle (#816).The generated
server_target.dartcreated theHotReloaderwithdebounceInterval: Duration.zero. Thehotreloaderpackage reuses that valueas the
pollingDelayfor any watcher that falls back to polling — notably forwatch paths that don't exist, such as an unused
bin/ortest/directory.With a zero delay this becomes a tight busy loop that pins a CPU core, on every
platform. Most Jaspr projects have neither
bin/nortest/, so two suchwatchers spin indefinitely.
This PR:
debounceInterval(200ms) in the generated entrypoint, so anypolling fallback no longer busy-loops. This alone fixes the reported issue.
excludedPathsforbin/testwhen those folders are absent, so no polling watcher is created for them in the
first place. Not strictly required once the above is in place — happy to drop
it if you prefer a more minimal change.
Type of Change
Ready Checklist
///).