refactor: short circuit previous installs when logdb is disabled

This commit is contained in:
sillock1 2024-05-04 00:30:01 +01:00
parent 7f0eb0f4f6
commit ea10fcb6a5
1 changed files with 5 additions and 3 deletions

View File

@ -48,10 +48,12 @@ namespace Sonarr.Api.V3.Update
installed.Installed = true;
}
var updateHistory = _configFileProvider.LogDbEnabled
? _updateHistoryService.InstalledSince(resources.Last().ReleaseDate)
: new List<UpdateHistory>();
if (!_configFileProvider.LogDbEnabled)
{
return resources;
}
var updateHistory = _updateHistoryService.InstalledSince(resources.Last().ReleaseDate);
var installDates = updateHistory
.DistinctBy(v => v.Version)
.ToDictionary(v => v.Version);