Merge pull request #4285 from cvium/fix_websocketlisteners

Fix IWebSocketListener service registration
This commit is contained in:
Joshua M. Boniface
2020-10-17 01:58:35 -04:00
committed by GitHub
5 changed files with 22 additions and 27 deletions

View File

@@ -4,6 +4,8 @@ using System.IO;
using System.Reflection;
using Emby.Drawing;
using Emby.Server.Implementations;
using Emby.Server.Implementations.Session;
using Jellyfin.Api.WebSocketListeners;
using Jellyfin.Drawing.Skia;
using Jellyfin.Server.Implementations;
using Jellyfin.Server.Implementations.Activity;
@@ -14,6 +16,7 @@ using MediaBrowser.Controller;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Events;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.IO;
using Microsoft.EntityFrameworkCore;
@@ -80,6 +83,14 @@ namespace Jellyfin.Server
ServiceCollection.AddSingleton<IUserManager, UserManager>();
ServiceCollection.AddSingleton<IDisplayPreferencesManager, DisplayPreferencesManager>();
ServiceCollection.AddScoped<IWebSocketListener, SessionWebSocketListener>();
ServiceCollection.AddScoped<IWebSocketListener, ActivityLogWebSocketListener>();
ServiceCollection.AddScoped<IWebSocketListener, ScheduledTasksWebSocketListener>();
ServiceCollection.AddScoped<IWebSocketListener, SessionInfoWebSocketListener>();
// TODO fix circular dependency on IWebSocketManager
ServiceCollection.AddScoped(serviceProvider => new Lazy<IEnumerable<IWebSocketListener>>(serviceProvider.GetRequiredService<IEnumerable<IWebSocketListener>>));
base.RegisterServices();
}

View File

@@ -378,7 +378,7 @@ namespace Jellyfin.Server
.ConfigureServices(services =>
{
// Merge the external ServiceCollection into ASP.NET DI
services.TryAdd(serviceCollection);
services.Add(serviceCollection);
})
.UseStartup<Startup>();
}