Skip to content
This repository has been archived by the owner on Dec 9, 2022. It is now read-only.

Concurrent Downloads #22

Merged
merged 80 commits into from
Jan 29, 2018
Merged

Concurrent Downloads #22

merged 80 commits into from
Jan 29, 2018

Conversation

AlienXAXS
Copy link
Contributor

@AlienXAXS AlienXAXS commented Jan 20, 2018

To use this feature with logging, including the concurrent download debug window, start the launcher with the --log and --firstInstall parameters.

Image to debug screen This debug screen will only show if --log is set in the parameters, it was very useful to track down some bugs.

I have tested every possible install method (bar updating - i will test this soon), I have also tested it over different operating systems, and different users - all users reported a much faster download and install time with this setup.

The debug dialog can be useful to see what downloads are actually happening.

Also, this update renderes the Friendly Name Pull Request useless, as there is no way to really show what server(s) you're downloading from without it looking extremely cluttered.

AlienXAXS added 30 commits January 12, 2018 11:54
Note:
The Patcher Progress screen doesnt seem to update any more, but pushing as i need the code at home from work.
- Also added a debug console, only opens during Visual Studio DEBUG mode enabled.
Start the app with --log to open the console logger
It used to sit at 100% while applying file metadata, this is sorted now.
These dont do anything yet.
While not needed to make the project compile, it is needed to keep our application the same throughout
- Is buggy, but commiting so i can grab it at home
AlienXAXS added 27 commits January 27, 2018 22:37
While not needed to make the project compile, it is needed to keep our application the same throughout
- Is buggy, but commiting so i can grab it at home
also incremented the version number of the launcher ready for patching
Copy link
Contributor

@JAJames JAJames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some changes need to be done, however none of them should break the launcher and I really want to get a patch out with this ASAP.

Please make a separate PR to address comments

@@ -43,8 +43,10 @@ public override int Run(string[] remainingArguments)
return 1;
}

RxPatcher.Instance.AddNewUpdateServer(remainingArguments[0], "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patchUrl would be more descriptive than remainingArguments[0]

// The RenX client seems to crash around here when the cancel button is pressed
// while it does crash, it does however achieve our goal of stopping the download
// (I'm not saying that it's right, i just dont know how to fix it right now.)
RxLogger.Logger.Instance.Write($"{ex.Message}\r\nStack Trace:\r\n{ex.StackTrace}", Logger.ErrorLevel.ErrError);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self note: make an issue for this after merging

RxLogger.Logger.Instance.Write(
$"Spawning Background Workers - Detected {Environment.ProcessorCount} processors, using {(Environment.ProcessorCount > 4 ? 4 : Environment.ProcessorCount)} of them");

for (var i = 0; i < (Environment.ProcessorCount > MaximumDeltaThreads ? MaximumDeltaThreads : Environment.ProcessorCount); i++)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Min here would be a bit clearer; this could also probably just be applied directly to MaximumDeltaThreads instead of here. So the end code here might end up just being:

while (bgWorkers.Count < MaximumDeltaThreads)

Min documentation: https://msdn.microsoft.com/en-us/library/microsoft.xna.framework.mathhelper.min.aspx

// Update progress
progress.AdvanceItem(action.PatchSize);
progressCallback(progress);
foreach (var x in bgWorkers)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a stylistic suggestion, try to avoid using single-letter variables. worker is much more descriptive than x, for example.

}

while (tmpActions.Any(x => !x.IsComplete))
{
await Task.Delay(1000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self note: make an issue for this

/// <returns>The name of the country that belongs to the IPAddress</returns>
static async Task<string[]> GrabCountry(string IPAddress)
static async Task<string[]> GrabCountry(string ipAddress)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self note: I still need to add country codes to the server list so we can remove this from the launcher

Name = "0.77-dev",
Number = 077
Name = "0.8",
Number = 08
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version number actually needs to be at least as big as the last one (8 < 77); I'll PR a change to set this to 0 though and instead start making branches for each release with the version number

GamePatchUrls = UpdateServerModelFactory.CreateUpdateServerModels(versionData["game"]["patch_urls"].ToObject<string[]>());

// Server URL's list & Friendly Names
foreach (var x in versionData["game"]["server_urls"].ToObject<dynamic>())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it might not be exclusively urls in the future, maybe we should change this to just mirrors at some point

return string.Format("{0}%", perc.ToString("0.##"));
return $"{perc:0.##}%";
}
else if ( progress.DownloadThreads == 0 )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should really stick to using the state code, rather than checking the download threads manually here

this.StatusMessage = "Operation cancelled by User";
Application.Current.Shutdown();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cancel should not close the entire application; it should only cancel the patch

@JAJames JAJames merged commit 5690473 into master Jan 29, 2018
@JAJames JAJames deleted the concurrent_downloads branch January 29, 2018 01:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants