Merged PR 523773: Fix NRE when asking for GetStats with a failed startup

This commit is contained in:
Julian Bayardo 2019-12-10 23:11:29 +00:00
Родитель 18bc4c5411
Коммит 66cc175a00
1 изменённых файлов: 14 добавлений и 7 удалений

Просмотреть файл

@ -1192,14 +1192,21 @@ namespace BuildXL.Cache.ContentStore.Stores
if (StartupCompleted)
{
counters.Add($"{CurrentByteCountName}", QuotaKeeper.CurrentSize);
counters.Add($"{CurrentFileCountName}", await ContentDirectory.GetCountAsync());
counters.Merge(ContentDirectory.GetCounters(), "ContentDirectory.");
var quotaKeeperCounter = QuotaKeeper.Counters;
if (quotaKeeperCounter != null)
if (QuotaKeeper != null)
{
counters.Merge(quotaKeeperCounter.ToCounterSet());
counters.Add($"{CurrentByteCountName}", QuotaKeeper.CurrentSize);
var quotaKeeperCounter = QuotaKeeper.Counters;
if (quotaKeeperCounter != null)
{
counters.Merge(quotaKeeperCounter.ToCounterSet());
}
}
if (ContentDirectory != null)
{
counters.Add($"{CurrentFileCountName}", await ContentDirectory.GetCountAsync());
counters.Merge(ContentDirectory.GetCounters(), "ContentDirectory.");
}
}
return new GetStatsResult(counters);