Skip to content
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

[Bug]: Progress bar falls back when updating #667

Open
Gaojianli opened this issue Jan 14, 2025 · 3 comments
Open

[Bug]: Progress bar falls back when updating #667

Gaojianli opened this issue Jan 14, 2025 · 3 comments
Labels
Needs Triaging This issue needs the developer's attention to sort & prioritize.

Comments

@Gaojianli
Copy link

Affected Version

1.82.9

Bug Behavior

Progress bar falls back when updating. See the screenshot

Expected Behavior

Progress bar just increase.

Steps to reproduce

Upgrade to1.8.114

Related Issues

No response

Screenshot(s)

Collapse.2025-01-14.23-38-19.mp4

Additional Information

No response

@Gaojianli Gaojianli added the Needs Triaging This issue needs the developer's attention to sort & prioritize. label Jan 14, 2025
@neon-nyan
Copy link
Member

neon-nyan commented Jan 14, 2025

Hi there,
This might be related to update issue that happened on: #642 and should have been fixed in later releases (1.82.10 and later).
Try follow the instruction Here to force-update your launcher to the latest version.

@Gaojianli
Copy link
Author

Gaojianli commented Jan 14, 2025 via email

@bagusnl
Copy link
Member

bagusnl commented Jan 16, 2025

Corresponding code

private void FallbackCDNUtil_DownloadProgress(object sender, DownloadEvent e)
{
double speed = e.SizeDownloaded / CurrentStopwatch.Elapsed.TotalSeconds;
TimeSpan timeLeft = ToTimeSpanRemain(e.SizeToBeDownloaded, e.SizeDownloaded, speed);
DispatcherQueue?.TryEnqueue(() =>
{
progressBar.IsIndeterminate = false;
progressBar.Value = e.ProgressPercentage;
ActivityStatus.Text = string.Format(Lang._UpdatePage.UpdateStatus3, 1, 1);
ActivitySubStatus.Text =
$"{SummarizeSizeSimple(e.SizeDownloaded)} / {SummarizeSizeSimple(e.SizeToBeDownloaded)}";
SpeedStatus.Text =
string.Format(Lang._Misc.SpeedPerSec, SummarizeSizeSimple(speed));
TimeEstimation.Text = string.Format(Lang._Misc.TimeRemainHMSFormat, timeLeft);
});
}

Fix proposal

+  private double _progressLastValue {get; set;} = 0;
   private void FallbackCDNUtil_DownloadProgress(object sender, DownloadEvent e) 
   { 
       double speed      = e.SizeDownloaded / CurrentStopwatch.Elapsed.TotalSeconds; 
       TimeSpan timeLeft = ToTimeSpanRemain(e.SizeToBeDownloaded, e.SizeDownloaded, speed); 
    
       DispatcherQueue?.TryEnqueue(() => 
                                   { 
+                                      var progressPercentage = e.ProgressPercentage;
                                       progressBar.IsIndeterminate = false; 
+                                      if (progressPercentage > _progressLastValue)
+                                      {
+                                          progressBar.Value    = progressPercentage; 
+                                          _progressLastValue   = progressPercentage;
+                                      }
-                                      progressBar.Value = e.ProgressPercentage; 
                                       ActivityStatus.Text = string.Format(Lang._UpdatePage.UpdateStatus3, 1, 1); 
                                       ActivitySubStatus.Text = 
                                           $"{SummarizeSizeSimple(e.SizeDownloaded)} / {SummarizeSizeSimple(e.SizeToBeDownloaded)}"; 
    
                                       SpeedStatus.Text = 
                                           string.Format(Lang._Misc.SpeedPerSec, SummarizeSizeSimple(speed)); 
                                       TimeEstimation.Text = string.Format(Lang._Misc.TimeRemainHMSFormat, timeLeft); 
                                   }); 
   } 

Practically force the progress bar to never go back in value
or something like that, don't have access to my PC atm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Triaging This issue needs the developer's attention to sort & prioritize.
Projects
None yet
Development

No branches or pull requests

3 participants