Skip to content

Reduce macOS update task polling frequency#1777

Open
learningpro wants to merge 2 commits intochen08209:mainfrom
learningpro:main
Open

Reduce macOS update task polling frequency#1777
learningpro wants to merge 2 commits intochen08209:mainfrom
learningpro:main

Conversation

@learningpro
Copy link

Motivation
The background update loop was scheduling tasks every second which can increase CPU usage and cause macOS devices to run hot, so the polling frequency should be relaxed on macOS and reduced further when the app window is hidden.
Description
Change startUpdateTasks to use a new helper _resolveUpdateInterval() and schedule the next run with the returned Duration; _resolveUpdateInterval() returns Duration(seconds: 1) by default, Duration(seconds: 3) on macOS when the window is visible, and Duration(seconds: 10) on macOS when the window is hidden.
Testing
No automated tests were run for this change.

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