Remove IServerEntryPoint
This commit is contained in:
parent
4c7eca9313
commit
19a72e8bf2
|
@ -62,7 +62,6 @@ using MediaBrowser.Controller.MediaEncoding;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
using MediaBrowser.Controller.Playlists;
|
using MediaBrowser.Controller.Playlists;
|
||||||
using MediaBrowser.Controller.Plugins;
|
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Controller.QuickConnect;
|
using MediaBrowser.Controller.QuickConnect;
|
||||||
using MediaBrowser.Controller.Resolvers;
|
using MediaBrowser.Controller.Resolvers;
|
||||||
|
@ -393,7 +392,7 @@ namespace Emby.Server.Implementations
|
||||||
/// Runs the startup tasks.
|
/// Runs the startup tasks.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns><see cref="Task" />.</returns>
|
/// <returns><see cref="Task" />.</returns>
|
||||||
public async Task RunStartupTasksAsync()
|
public Task RunStartupTasksAsync()
|
||||||
{
|
{
|
||||||
Logger.LogInformation("Running startup tasks");
|
Logger.LogInformation("Running startup tasks");
|
||||||
|
|
||||||
|
@ -405,38 +404,10 @@ namespace Emby.Server.Implementations
|
||||||
Resolve<IMediaEncoder>().SetFFmpegPath();
|
Resolve<IMediaEncoder>().SetFFmpegPath();
|
||||||
|
|
||||||
Logger.LogInformation("ServerId: {ServerId}", SystemId);
|
Logger.LogInformation("ServerId: {ServerId}", SystemId);
|
||||||
|
|
||||||
var entryPoints = GetExports<IServerEntryPoint>();
|
|
||||||
|
|
||||||
var stopWatch = new Stopwatch();
|
|
||||||
stopWatch.Start();
|
|
||||||
|
|
||||||
await Task.WhenAll(StartEntryPoints(entryPoints, true)).ConfigureAwait(false);
|
|
||||||
Logger.LogInformation("Executed all pre-startup entry points in {Elapsed:g}", stopWatch.Elapsed);
|
|
||||||
|
|
||||||
Logger.LogInformation("Core startup complete");
|
Logger.LogInformation("Core startup complete");
|
||||||
CoreStartupHasCompleted = true;
|
CoreStartupHasCompleted = true;
|
||||||
|
|
||||||
stopWatch.Restart();
|
return Task.CompletedTask;
|
||||||
|
|
||||||
await Task.WhenAll(StartEntryPoints(entryPoints, false)).ConfigureAwait(false);
|
|
||||||
Logger.LogInformation("Executed all post-startup entry points in {Elapsed:g}", stopWatch.Elapsed);
|
|
||||||
stopWatch.Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<Task> StartEntryPoints(IEnumerable<IServerEntryPoint> entryPoints, bool isBeforeStartup)
|
|
||||||
{
|
|
||||||
foreach (var entryPoint in entryPoints)
|
|
||||||
{
|
|
||||||
if (isBeforeStartup != (entryPoint is IRunBeforeStartup))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.LogDebug("Starting entry point {Type}", entryPoint.GetType());
|
|
||||||
|
|
||||||
yield return entryPoint.RunAsync();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
namespace MediaBrowser.Controller.Plugins
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates that a <see cref="IServerEntryPoint"/> should be invoked as a pre-startup task.
|
|
||||||
/// </summary>
|
|
||||||
public interface IRunBeforeStartup
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Plugins
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents an entry point for a module in the application. This interface is scanned for automatically and
|
|
||||||
/// provides a hook to initialize the module at application start.
|
|
||||||
/// The entry point can additionally be flagged as a pre-startup task by implementing the
|
|
||||||
/// <see cref="IRunBeforeStartup"/> interface.
|
|
||||||
/// </summary>
|
|
||||||
public interface IServerEntryPoint : IDisposable
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Run the initialization for this module. This method is invoked at application start.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|
||||||
Task RunAsync();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user