mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-08 01:17:17 +00:00
Add long request time tolerance
This commit is contained in:
parent
8aabdd8714
commit
64ecd514f2
@ -1,6 +1,5 @@
|
|||||||
using Gommon;
|
using Gommon;
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.Common.Models.Github;
|
|
||||||
using Ryujinx.Ava.Common.Models.GitLab;
|
using Ryujinx.Ava.Common.Models.GitLab;
|
||||||
using Ryujinx.Ava.UI.Helpers;
|
using Ryujinx.Ava.UI.Helpers;
|
||||||
using Ryujinx.Common;
|
using Ryujinx.Common;
|
||||||
@ -8,6 +7,7 @@ using Ryujinx.Common.Helper;
|
|||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Common.Utilities;
|
using Ryujinx.Common.Utilities;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Json;
|
using System.Net.Http.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
@ -41,6 +41,8 @@ namespace Ryujinx.Ava.Systems
|
|||||||
{
|
{
|
||||||
using HttpClient jsonClient = ConstructHttpClient();
|
using HttpClient jsonClient = ConstructHttpClient();
|
||||||
|
|
||||||
|
jsonClient.Timeout = TimeSpan.FromSeconds(10); // GitLab instance is located in Ukraine. Connection times will vary across the world.
|
||||||
|
|
||||||
if (_currentGitLabReleaseChannel == null)
|
if (_currentGitLabReleaseChannel == null)
|
||||||
{
|
{
|
||||||
GitLabReleaseChannels releaseChannels = await GitLabReleaseChannels.GetAsync(jsonClient);
|
GitLabReleaseChannels releaseChannels = await GitLabReleaseChannels.GetAsync(jsonClient);
|
||||||
@ -55,16 +57,12 @@ namespace Ryujinx.Ava.Systems
|
|||||||
|
|
||||||
string fetchedJson = await jsonClient.GetStringAsync(_currentGitLabReleaseChannel.GetLatestReleaseApiUrl());
|
string fetchedJson = await jsonClient.GetStringAsync(_currentGitLabReleaseChannel.GetLatestReleaseApiUrl());
|
||||||
GitLabReleasesJsonResponse fetched = JsonHelper.Deserialize(fetchedJson, _glSerializerContext.GitLabReleasesJsonResponse);
|
GitLabReleasesJsonResponse fetched = JsonHelper.Deserialize(fetchedJson, _glSerializerContext.GitLabReleasesJsonResponse);
|
||||||
_buildVer = fetched.TagName;
|
|
||||||
|
|
||||||
foreach (GitLabReleaseAssetJsonResponse.GitLabReleaseAssetLinkJsonResponse asset in fetched.Assets.Links)
|
_buildVer = fetched.TagName;
|
||||||
{
|
_buildUrl = fetched.Assets.Links
|
||||||
if (asset.AssetName.StartsWith("ryujinx") && asset.AssetName.EndsWith(_platformExt))
|
.FirstOrDefault(link =>
|
||||||
{
|
link.AssetName.StartsWith("ryujinx") && link.AssetName.EndsWith(_platformExt)
|
||||||
_buildUrl = asset.Url;
|
)?.Url;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If build not done, assume no new update are available.
|
// If build not done, assume no new update are available.
|
||||||
if (_buildUrl is null)
|
if (_buildUrl is null)
|
||||||
|
@ -117,6 +117,7 @@ namespace Ryujinx.Ava.Systems
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
buildSizeClient.DefaultRequestHeaders.Add("Range", "bytes=0-0");
|
buildSizeClient.DefaultRequestHeaders.Add("Range", "bytes=0-0");
|
||||||
|
buildSizeClient.Timeout = TimeSpan.FromSeconds(10); // GitLab instance is located in Ukraine. Connection times will vary across the world.
|
||||||
|
|
||||||
HttpResponseMessage message = await buildSizeClient.GetAsync(new Uri(_buildUrl), HttpCompletionOption.ResponseHeadersRead);
|
HttpResponseMessage message = await buildSizeClient.GetAsync(new Uri(_buildUrl), HttpCompletionOption.ResponseHeadersRead);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user