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

Commit

Permalink
[GH Idx] Stop uploading empty blob when job crashes (#787)
Browse files Browse the repository at this point in the history
* [GH Idx] Stop uploading empty blob when job crashes

* [GH Idx] Add logging and tests for empty blob
  • Loading branch information
mogah authored Jul 31, 2019
1 parent 1d8bf41 commit f685362
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
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

0 comments on commit f685362

Please sign in to comment.