We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
查看了源码发现下面文件因为RequestCount是static的,第一包请求时调用GetPackageVersionRequestURL返回了正确的地址,轮到第二个包请求时就会直接返回了FallbackURL
`
using System.IO;
namespace YooAsset { internal class QueryRemotePackageVersionOperation : AsyncOperationBase { private enum ESteps { None, DownloadPackageVersion, Done, }
private static int RequestCount = 0; private readonly IRemoteServices _remoteServices; private readonly string _packageName; private readonly bool _appendTimeTicks; private readonly int _timeout; private UnityWebDataRequester _downloader; private ESteps _steps = ESteps.None; /// <summary> /// 包裹版本 /// </summary> public string PackageVersion { private set; get; } public QueryRemotePackageVersionOperation(IRemoteServices remoteServices, string packageName, bool appendTimeTicks, int timeout) { _remoteServices = remoteServices; _packageName = packageName; _appendTimeTicks = appendTimeTicks; _timeout = timeout; } internal override void Start() { RequestCount++; _steps = ESteps.DownloadPackageVersion; } internal override void Update() { if (_steps == ESteps.None || _steps == ESteps.Done) return; if (_steps == ESteps.DownloadPackageVersion) { if (_downloader == null) { string fileName = YooAssetSettingsData.GetPackageVersionFileName(_packageName); string webURL = GetPackageVersionRequestURL(fileName); YooLogger.Log($"Beginning to request package version : {webURL}"); _downloader = new UnityWebDataRequester(); _downloader.SendRequest(webURL, _timeout); } Progress = _downloader.Progress(); if (_downloader.IsDone() == false) return; if (_downloader.HasError()) { _steps = ESteps.Done; Status = EOperationStatus.Failed; Error = _downloader.GetError(); } else { PackageVersion = _downloader.GetText(); if (string.IsNullOrEmpty(PackageVersion)) { _steps = ESteps.Done; Status = EOperationStatus.Failed; Error = $"Remote package version is empty : {_downloader.URL}"; } else { _steps = ESteps.Done; Status = EOperationStatus.Succeed; } } _downloader.Dispose(); } } private string GetPackageVersionRequestURL(string fileName) { string url; // 轮流返回请求地址 if (RequestCount % 2 == 0) url = _remoteServices.GetRemoteFallbackURL(fileName); else url = _remoteServices.GetRemoteMainURL(fileName); // 在URL末尾添加时间戳 if (_appendTimeTicks) return $"{url}?{System.DateTime.UtcNow.Ticks}"; else return url; } }
}
The text was updated successfully, but these errors were encountered:
本质上应该是图省事没有做重试逻辑导致的,这种写法有四处,需要在这4个地方添加重试
Sorry, something went wrong.
fixed 49b1889
Successfully merging a pull request may close this issue.
查看了源码发现下面文件因为RequestCount是static的,第一包请求时调用GetPackageVersionRequestURL返回了正确的地址,轮到第二个包请求时就会直接返回了FallbackURL
`
using System.IO;
namespace YooAsset
{
internal class QueryRemotePackageVersionOperation : AsyncOperationBase
{
private enum ESteps
{
None,
DownloadPackageVersion,
Done,
}
}
`
The text was updated successfully, but these errors were encountered: