mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Implement metrics
This commit is contained in:
parent
ab6e3a02ea
commit
1d03c216d1
@ -950,6 +950,9 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
const int maxTries = 5;
|
const int maxTries = 5;
|
||||||
|
|
||||||
|
bool statIsRetrying = false;
|
||||||
|
bool statIsHttp = false;
|
||||||
|
|
||||||
App.Logger.WriteLine(LOG_IDENT, "Downloading...");
|
App.Logger.WriteLine(LOG_IDENT, "Downloading...");
|
||||||
|
|
||||||
var buffer = new byte[4096];
|
var buffer = new byte[4096];
|
||||||
@ -1002,8 +1005,12 @@ namespace Bloxstrap
|
|||||||
App.Logger.WriteLine(LOG_IDENT, $"An exception occurred after downloading {totalBytesRead} bytes. ({i}/{maxTries})");
|
App.Logger.WriteLine(LOG_IDENT, $"An exception occurred after downloading {totalBytesRead} bytes. ({i}/{maxTries})");
|
||||||
App.Logger.WriteException(LOG_IDENT, ex);
|
App.Logger.WriteException(LOG_IDENT, ex);
|
||||||
|
|
||||||
|
statIsRetrying = true;
|
||||||
|
|
||||||
if (ex.GetType() == typeof(ChecksumFailedException))
|
if (ex.GetType() == typeof(ChecksumFailedException))
|
||||||
{
|
{
|
||||||
|
_ = App.HttpClient.GetAsync($"http://bloxstraplabs.com/metrics/post?key=packageDownloadState&value=httpFail");
|
||||||
|
|
||||||
Frontend.ShowConnectivityDialog(
|
Frontend.ShowConnectivityDialog(
|
||||||
Strings.Dialog_Connectivity_UnableToDownload,
|
Strings.Dialog_Connectivity_UnableToDownload,
|
||||||
String.Format(Strings.Dialog_Connectivity_UnableToDownloadReason, "[https://github.com/pizzaboxer/bloxstrap/wiki/Bloxstrap-is-unable-to-download-Roblox](https://github.com/pizzaboxer/bloxstrap/wiki/Bloxstrap-is-unable-to-download-Roblox)"),
|
String.Format(Strings.Dialog_Connectivity_UnableToDownloadReason, "[https://github.com/pizzaboxer/bloxstrap/wiki/Bloxstrap-is-unable-to-download-Roblox](https://github.com/pizzaboxer/bloxstrap/wiki/Bloxstrap-is-unable-to-download-Roblox)"),
|
||||||
@ -1029,9 +1036,16 @@ namespace Bloxstrap
|
|||||||
{
|
{
|
||||||
App.Logger.WriteLine(LOG_IDENT, "Retrying download over HTTP...");
|
App.Logger.WriteLine(LOG_IDENT, "Retrying download over HTTP...");
|
||||||
packageUrl = packageUrl.Replace("https://", "http://");
|
packageUrl = packageUrl.Replace("https://", "http://");
|
||||||
|
statIsHttp = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (statIsRetrying)
|
||||||
|
{
|
||||||
|
string stat = statIsHttp ? "httpSuccess" : "retrySuccess";
|
||||||
|
_ = App.HttpClient.GetAsync($"http://bloxstraplabs.com/metrics/post?key=packageDownloadState&value={stat}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExtractPackage(Package package, List<string>? files = null)
|
private void ExtractPackage(Package package, List<string>? files = null)
|
||||||
|
Loading…
Reference in New Issue
Block a user