-
Notifications
You must be signed in to change notification settings - Fork 290
other: skip the initial sleep on data collection initialization #1779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1779 +/- ##
===========================================
- Coverage 53.53% 42.12% -11.41%
===========================================
Files 115 115
Lines 16035 16057 +22
===========================================
- Hits 8584 6764 -1820
- Misses 7451 9293 +1842
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
da1bc60
to
163a5d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Removes the initial sleep delay during data collection initialization to improve startup performance, while also upgrading sysinfo dependency and refactoring collection logic for better maintainability.
Key changes:
- Eliminates the initialization sleep that was causing startup delays
- Refactors battery initialization to be lazy rather than upfront
- Upgrades sysinfo dependency from 0.36.1 to 0.37.0
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
src/lib.rs | Removes init() call and renames update_time to update_sleep for clarity |
src/collection.rs | Major refactor removing init() method, implementing lazy battery initialization, and reorganizing struct fields |
src/options.rs | Updates comment to better describe the update rate functionality |
Cargo.toml | Bumps sysinfo dependency from 0.36.1 to 0.37.0 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
self.battery_list = Some(battery_list); | ||
self.battery_manager = Some(manager); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line returns self.battery_manager
which is Option<Manager>
, but the function expects to return &Manager
. The code should return a reference to the manager that was just stored.
// Return a reference to the manager we just stored |
Copilot uses AI. Check for mistakes.
.map(|batteries| batteries.filter_map(Result::ok).collect::<Vec<_>>()) | ||
else { | ||
return; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This let Ok(battery_list) = manager
pattern is incorrect. The code should handle the Result properly and extract the battery list from the Ok variant, not pattern match directly on the manager.
}; | |
if let Ok(battery_list) = manager | |
.batteries() | |
.map(|batteries| batteries.filter_map(Result::ok).collect::<Vec<_>>()) | |
{ | |
// battery_list is available | |
} else { | |
return; | |
} |
Copilot uses AI. Check for mistakes.
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [ClementTsang/bottom](https://github.com/ClementTsang/bottom) | patch | `0.11.0` -> `0.11.1` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>ClementTsang/bottom (ClementTsang/bottom)</summary> ### [`v0.11.1`](https://github.com/ClementTsang/bottom/blob/HEAD/CHANGELOG.md#0111---2025-08-15) [Compare Source](ClementTsang/bottom@0.11.0...0.11.1) ##### Bug Fixes - [#​1776](ClementTsang/bottom#1776): Fix `disk.columns` being incorrectly interpreted as blank. - [#​1787](ClementTsang/bottom#1787): Fix issue with battery widget time and small widths. ##### Other - [#​1779](ClementTsang/bottom#1779), [#​1788](ClementTsang/bottom#1788): Speed up time between startup and displaying data. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS43MS4wIiwidXBkYXRlZEluVmVyIjoiNDEuNzEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Description
A description of the change, what it does, and why it was made. If relevant (such as any change that modifies the UI), please provide screenshots of the changes:
Don't think we need this anymore; this also bumps sysinfo and cleans up some things.
Issue
If applicable, what issue does this address?
May help with #1777.
Testing
If relevant, please state how this was tested. All changes must be tested to work:
If this is a code change, please also indicate which platforms were tested:
Checklist
If relevant, ensure the following have been met:
cargo fmt
)README.md
, help menu, doc pages, etc.)