aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Updates
diff options
context:
space:
mode:
authorPetr Janda <petr.janda@holidaysinhell.com>2019-12-05 19:29:20 +1030
committerPetr Janda <petr.janda@holidaysinhell.com>2019-12-05 19:29:20 +1030
commit7cde256402a5669bb4b71e02720d62c792931ecb (patch)
tree81d03395a3a4c7b9a073f55784dddc6bd9c92402 /Emby.Server.Implementations/Updates
parent70530e1f1415522a601709e11a31f8eb6a3f0a64 (diff)
parent82575db6620fa7ddbcfd908d9575b85eeeb4ad07 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'Emby.Server.Implementations/Updates')
-rw-r--r--Emby.Server.Implementations/Updates/InstallationManager.cs18
1 files changed, 11 insertions, 7 deletions
diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs
index 1c5402268..09a5a0dca 100644
--- a/Emby.Server.Implementations/Updates/InstallationManager.cs
+++ b/Emby.Server.Implementations/Updates/InstallationManager.cs
@@ -180,7 +180,7 @@ namespace Emby.Server.Implementations.Updates
// Package not found.
if (package == null)
{
- return null;
+ return Enumerable.Empty<PackageVersionInfo>();
}
return GetCompatibleVersions(
@@ -190,19 +190,23 @@ namespace Emby.Server.Implementations.Updates
}
/// <inheritdoc />
- public async Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdates(CancellationToken cancellationToken = default)
+ public async IAsyncEnumerable<PackageVersionInfo> GetAvailablePluginUpdates(CancellationToken cancellationToken = default)
{
var catalog = await GetAvailablePackages(cancellationToken).ConfigureAwait(false);
var systemUpdateLevel = _applicationHost.SystemUpdateLevel;
// Figure out what needs to be installed
- return _applicationHost.Plugins.Select(x =>
+ foreach (var plugin in _applicationHost.Plugins)
{
- var compatibleversions = GetCompatibleVersions(catalog, x.Name, x.Id, x.Version, systemUpdateLevel);
- return compatibleversions.FirstOrDefault(y => y.Version > x.Version);
- }).Where(x => x != null)
- .Where(x => !CompletedInstallations.Any(y => string.Equals(y.AssemblyGuid, x.guid, StringComparison.OrdinalIgnoreCase)));
+ var compatibleversions = GetCompatibleVersions(catalog, plugin.Name, plugin.Id, plugin.Version, systemUpdateLevel);
+ var version = compatibleversions.FirstOrDefault(y => y.Version > plugin.Version);
+ if (version != null
+ && !CompletedInstallations.Any(x => string.Equals(x.AssemblyGuid, version.guid, StringComparison.OrdinalIgnoreCase)))
+ {
+ yield return version;
+ }
+ }
}
/// <inheritdoc />