Skip to content
New issue

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

Log errors instead of PRs for OOO mods on GitHub #3625

Merged
merged 1 commit into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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