-
Notifications
You must be signed in to change notification settings - Fork 666
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
[cli] Only update progress when percentage goes up #2979
Conversation
@@ -522,6 +522,7 @@ void mp::LXDVMImageVault::poll_download_operation(const QJsonObject& json_reply, | |||
.arg(json_reply["metadata"].toObject()["id"].toString())); | |||
|
|||
// Instead of polling, need to use websockets to get events | |||
auto last_download_progress = -2; |
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.
I use -2
because there are two different states that are being checked here. The above reply can either return a percentage for download progress (located under download_progress -> rootfs
in the json reply, or a percentage for metadata download progress (located under download_progress -> metadata
. The above helper function parse_percent_as_int()
will return -1
when downloading metadata, so a starting value of -2
is used so that the downloading message will still be displayed in the cli.
Codecov Report
@@ Coverage Diff @@
## main #2979 +/- ##
==========================================
- Coverage 86.89% 86.87% -0.03%
==========================================
Files 231 231
Lines 12042 12049 +7
==========================================
+ Hits 10464 10467 +3
- Misses 1578 1582 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
Hey @sharder996!
Thanks for this! I tried this out on Windows and can say it's much better than before. That said, I'm still seeing an occasional flicker. Is that expected?
Hey @townsend2010, thanks for the review! It shouldn't be flickering, except when the percentage changes. The whole line gets updated then so it may flash briefly. Also, this PR only affects the download percentage message so other messages, such as those that have a spinner, may still flicker because of how often they get updated. |
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.
Ok, makes sense, thanks! LGTM!
bors merge
Fixes #1532