|
@@ -9,6 +9,7 @@ using ET;
|
|
|
public static class PatchUpdater
|
|
|
{
|
|
|
private static bool _isRun = false;
|
|
|
+ private static int _retryCnt = 0;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 下载器
|
|
@@ -135,23 +136,36 @@ public static class PatchUpdater
|
|
|
}
|
|
|
else if (msg is PatchEventMessageDefine.StaticVersionUpdateFailed)
|
|
|
{
|
|
|
- System.Action callback = () => { PatchUpdater.HandleOperation(EPatchOperation.TryUpdateStaticVersion); };
|
|
|
- ET.Log.Info($"Failed to update static version, please check the network status.", callback);
|
|
|
+ ET.Log.Error($"Failed to update static version, please check the network status.");
|
|
|
+ ErrorRetry(EPatchOperation.TryUpdateStaticVersion);
|
|
|
}
|
|
|
else if (msg is PatchEventMessageDefine.PatchManifestUpdateFailed)
|
|
|
{
|
|
|
- System.Action callback = () => { PatchUpdater.HandleOperation(EPatchOperation.TryUpdatePatchManifest); };
|
|
|
- ET.Log.Info($"Failed to update patch manifest, please check the network status.", callback);
|
|
|
+ ET.Log.Error($"Failed to update patch manifest, please check the network status.");
|
|
|
+ ErrorRetry(EPatchOperation.TryUpdatePatchManifest);
|
|
|
}
|
|
|
else if (msg is PatchEventMessageDefine.WebFileDownloadFailed)
|
|
|
{
|
|
|
var message = msg as PatchEventMessageDefine.WebFileDownloadFailed;
|
|
|
- System.Action callback = () => { PatchUpdater.HandleOperation(EPatchOperation.TryDownloadWebFiles); };
|
|
|
- ET.Log.Info($"Failed to download file : {message.FileName}", callback);
|
|
|
+ ET.Log.Error($"Failed to download file : {message.FileName}");
|
|
|
+ ErrorRetry(EPatchOperation.TryDownloadWebFiles);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
throw new System.NotImplementedException($"{msg.GetType()}");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private static void ErrorRetry(EPatchOperation operation)
|
|
|
+ {
|
|
|
+ if (++_retryCnt >= 3)
|
|
|
+ {
|
|
|
+ Log.Error("Retry 3 times, Abort.");
|
|
|
+ s_UniTaskCompletionSource?.TrySetResult();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ PatchUpdater.HandleOperation(operation);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|