From a2dff986f0079db6762bd178d4d6aa9f3d6a5abe Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Thu, 11 Aug 2022 16:02:43 -0500 Subject: [PATCH] Log errors instead of PRs for OOO mods on GitHub --- Netkan/Transformers/EpochTransformer.cs | 13 ++++++++++--- Netkan/Transformers/GithubTransformer.cs | 3 +++ Netkan/Transformers/ITransformer.cs | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Netkan/Transformers/EpochTransformer.cs b/Netkan/Transformers/EpochTransformer.cs index 0bf177d8b1..8640812204 100644 --- a/Netkan/Transformers/EpochTransformer.cs +++ b/Netkan/Transformers/EpochTransformer.cs @@ -63,9 +63,16 @@ public IEnumerable Transform(Metadata metadata, TransformOptions opts) if (!opts.HighestVersion.EpochEquals(currentV) && startV < opts.HighestVersion && opts.HighestVersion < currentV) { - // New file, tell the Indexer to be careful - opts.Staged = true; - opts.StagingReasons.Add($"Auto-epoching out of order version: {startV} < {opts.HighestVersion} < {currentV}"); + if (opts.FlakyAPI) + { + throw new Kraken($"Out-of-order version found on unreliable server: {startV} < {opts.HighestVersion} < {currentV}"); + } + else + { + // New file, tell the Indexer to be careful + opts.Staged = true; + opts.StagingReasons.Add($"Auto-epoching out of order version: {startV} < {opts.HighestVersion} < {currentV}"); + } } json["version"] = currentV.ToString(); } diff --git a/Netkan/Transformers/GithubTransformer.cs b/Netkan/Transformers/GithubTransformer.cs index 813ac7e3e5..3a80377187 100644 --- a/Netkan/Transformers/GithubTransformer.cs +++ b/Netkan/Transformers/GithubTransformer.cs @@ -38,6 +38,9 @@ public IEnumerable Transform(Metadata metadata, TransformOptions opts) { var json = metadata.Json(); + // Tell downstream translators that this host's API is unreliable + opts.FlakyAPI = true; + Log.InfoFormat("Executing GitHub transformation with {0}", metadata.Kref); Log.DebugFormat("Input metadata:{0}{1}", Environment.NewLine, json); diff --git a/Netkan/Transformers/ITransformer.cs b/Netkan/Transformers/ITransformer.cs index d710738085..60e8dbdda1 100644 --- a/Netkan/Transformers/ITransformer.cs +++ b/Netkan/Transformers/ITransformer.cs @@ -24,6 +24,7 @@ public TransformOptions(int? releases, int? skipReleases, ModuleVersion highVer, public readonly ModuleVersion HighestVersion; public bool Staged; public readonly List StagingReasons; + public bool FlakyAPI = false; } ///