Skip to content

Commit

Permalink
Write final results json directly onto disk
Browse files Browse the repository at this point in the history
  • Loading branch information
MihaZupan committed Sep 1, 2024
1 parent dab4476 commit 97c52d9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Runner/RegexDiffJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,12 @@ static string ParseCSharpLiteral(ReadOnlySpan<char> literal, out int indexOfEndi
private async Task UploadResultsAsync(RegexEntry[] entries)
{
Directory.CreateDirectory("Results");
File.WriteAllText("Results/Results.json", JsonSerializer.Serialize(entries, s_jsonOptions));

using (FileStream jsonFs = File.Create("Results/Results.json"))
{
JsonSerializer.Serialize(jsonFs, entries, s_jsonOptions);
}

PendingTasks.Enqueue(ZipAndUploadArtifactAsync("Results", "Results"));

if (entries.Any(e => e.ShortDiff is not null))
Expand Down Expand Up @@ -376,6 +381,11 @@ static string GenerateExamplesMarkdown(RegexEntry[] entries, int maxMarkdownLeng
continue;
}

if (sb.Length + diff.Length > maxMarkdownLength)
{
continue;
}

int startLength = sb.Length;

string options = entry.Regex.Options.ToString();
Expand Down

0 comments on commit 97c52d9

Please sign in to comment.