Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
/ NuGet.Jobs Public archive

[GH Idx] Stop uploading empty blob when job crashes #787

Merged
merged 2 commits into from
Jul 31, 2019
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
10 changes: 9 additions & 1 deletion src/NuGet.Jobs.GitHubIndexer/ReposIndexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,15 @@ await ProcessInParallel(inputBag, repo =>
.ThenBy(x => x.Id)
.ToList();

await WriteFinalBlobAsync(finalList);
if (finalList.Any())
{
await WriteFinalBlobAsync(finalList);
}
else
{
// TODO: Add telemetry for this (https://github.com/NuGet/NuGetGallery/issues/7359)
_logger.LogError("The final blob is empty!");
}

// Delete the repos and cache directory
Directory.Delete(RepositoriesDirectory, recursive: true);
Expand Down
5 changes: 4 additions & 1 deletion tests/NuGet.Jobs.GitHubIndexer.Tests/ReposIndexerFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ public async Task TestNoDependenciesInFiles()
new GitFileInfo(configFileNames[3], 1)
};

var indexer = CreateIndexer(repo, repoFiles, onDisposeHandler: null);
var indexer = CreateIndexer(repo,
repoFiles,
// This should not be called since there is no dependencies
onDisposeHandler: (string serializedValue) => Assert.True(false));
await indexer.RunAsync();

var result = repo.ToRepositoryInformation();
Expand Down