diff --git a/src/NuGet.Jobs.GitHubIndexer/ReposIndexer.cs b/src/NuGet.Jobs.GitHubIndexer/ReposIndexer.cs index 4c9b118f4..64a205cc8 100644 --- a/src/NuGet.Jobs.GitHubIndexer/ReposIndexer.cs +++ b/src/NuGet.Jobs.GitHubIndexer/ReposIndexer.cs @@ -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); diff --git a/tests/NuGet.Jobs.GitHubIndexer.Tests/ReposIndexerFacts.cs b/tests/NuGet.Jobs.GitHubIndexer.Tests/ReposIndexerFacts.cs index 17d700168..d9fda96fd 100644 --- a/tests/NuGet.Jobs.GitHubIndexer.Tests/ReposIndexerFacts.cs +++ b/tests/NuGet.Jobs.GitHubIndexer.Tests/ReposIndexerFacts.cs @@ -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();