Skip to content

Commit

Permalink
Log errors instead of PRs for OOO mods on GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Aug 11, 2022
1 parent 4296d75 commit a2dff98
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Netkan/Transformers/EpochTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,16 @@ public IEnumerable<Metadata> 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();
}
Expand Down
3 changes: 3 additions & 0 deletions Netkan/Transformers/GithubTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public IEnumerable<Metadata> 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);

Expand Down
1 change: 1 addition & 0 deletions Netkan/Transformers/ITransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public TransformOptions(int? releases, int? skipReleases, ModuleVersion highVer,
public readonly ModuleVersion HighestVersion;
public bool Staged;
public readonly List<string> StagingReasons;
public bool FlakyAPI = false;
}

/// <summary>
Expand Down

0 comments on commit a2dff98

Please sign in to comment.