Merge pull request #736 from Bond-009/startasync
Start startup tasks async
This commit is contained in:
commit
c4f51e16a5
|
@ -4,6 +4,7 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Emby.Dlna.Profiles;
|
using Emby.Dlna.Profiles;
|
||||||
using Emby.Dlna.Server;
|
using Emby.Dlna.Server;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
|
@ -48,11 +49,11 @@ namespace Emby.Dlna
|
||||||
_assemblyInfo = assemblyInfo;
|
_assemblyInfo = assemblyInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitProfiles()
|
public async Task InitProfilesAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ExtractSystemProfiles();
|
await ExtractSystemProfilesAsync();
|
||||||
LoadProfiles();
|
LoadProfiles();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -359,7 +360,7 @@ namespace Emby.Dlna
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExtractSystemProfiles()
|
private async Task ExtractSystemProfilesAsync()
|
||||||
{
|
{
|
||||||
var namespaceName = GetType().Namespace + ".Profiles.Xml.";
|
var namespaceName = GetType().Namespace + ".Profiles.Xml.";
|
||||||
|
|
||||||
|
@ -383,7 +384,7 @@ namespace Emby.Dlna
|
||||||
|
|
||||||
using (var fileStream = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
|
using (var fileStream = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
|
||||||
{
|
{
|
||||||
stream.CopyTo(fileStream);
|
await stream.CopyToAsync(fileStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,9 +125,9 @@ namespace Emby.Dlna.Main
|
||||||
Current = this;
|
Current = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public async Task RunAsync()
|
||||||
{
|
{
|
||||||
((DlnaManager)_dlnaManager).InitProfiles();
|
await ((DlnaManager)_dlnaManager).InitProfilesAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
ReloadComponents();
|
ReloadComponents();
|
||||||
|
|
||||||
|
|
|
@ -71,12 +71,14 @@ namespace Emby.Notifications
|
||||||
_coreNotificationTypes = new CoreNotificationTypes(localization, appHost).GetNotificationTypes().Select(i => i.Type).ToArray();
|
_coreNotificationTypes = new CoreNotificationTypes(localization, appHost).GetNotificationTypes().Select(i => i.Type).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
_libraryManager.ItemAdded += _libraryManager_ItemAdded;
|
_libraryManager.ItemAdded += _libraryManager_ItemAdded;
|
||||||
_appHost.HasPendingRestartChanged += _appHost_HasPendingRestartChanged;
|
_appHost.HasPendingRestartChanged += _appHost_HasPendingRestartChanged;
|
||||||
_appHost.HasUpdateAvailableChanged += _appHost_HasUpdateAvailableChanged;
|
_appHost.HasUpdateAvailableChanged += _appHost_HasUpdateAvailableChanged;
|
||||||
_activityManager.EntryCreated += _activityManager_EntryCreated;
|
_activityManager.EntryCreated += _activityManager_EntryCreated;
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void _appHost_HasPendingRestartChanged(object sender, EventArgs e)
|
private async void _appHost_HasPendingRestartChanged(object sender, EventArgs e)
|
||||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Common.Plugins;
|
using MediaBrowser.Common.Plugins;
|
||||||
using MediaBrowser.Common.Updates;
|
using MediaBrowser.Common.Updates;
|
||||||
|
@ -58,7 +59,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
_deviceManager = deviceManager;
|
_deviceManager = deviceManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
_taskManager.TaskCompleted += _taskManager_TaskCompleted;
|
_taskManager.TaskCompleted += _taskManager_TaskCompleted;
|
||||||
|
|
||||||
|
@ -90,6 +91,8 @@ namespace Emby.Server.Implementations.Activity
|
||||||
_deviceManager.CameraImageUploaded += _deviceManager_CameraImageUploaded;
|
_deviceManager.CameraImageUploaded += _deviceManager_CameraImageUploaded;
|
||||||
|
|
||||||
_appHost.ApplicationUpdated += _appHost_ApplicationUpdated;
|
_appHost.ApplicationUpdated += _appHost_ApplicationUpdated;
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _deviceManager_CameraImageUploaded(object sender, GenericEventArgs<CameraImageUploadInfo> e)
|
void _deviceManager_CameraImageUploaded(object sender, GenericEventArgs<CameraImageUploadInfo> e)
|
||||||
|
|
|
@ -645,8 +645,10 @@ namespace Emby.Server.Implementations
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs the startup tasks.
|
/// Runs the startup tasks.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Task RunStartupTasks()
|
public async Task RunStartupTasks()
|
||||||
{
|
{
|
||||||
|
Logger.LogInformation("Running startup tasks");
|
||||||
|
|
||||||
Resolve<ITaskManager>().AddTasks(GetExports<IScheduledTask>(false));
|
Resolve<ITaskManager>().AddTasks(GetExports<IScheduledTask>(false));
|
||||||
|
|
||||||
ConfigurationManager.ConfigurationUpdated += OnConfigurationUpdated;
|
ConfigurationManager.ConfigurationUpdated += OnConfigurationUpdated;
|
||||||
|
@ -665,20 +667,20 @@ namespace Emby.Server.Implementations
|
||||||
Logger.LogInformation("ServerId: {0}", SystemId);
|
Logger.LogInformation("ServerId: {0}", SystemId);
|
||||||
|
|
||||||
var entryPoints = GetExports<IServerEntryPoint>();
|
var entryPoints = GetExports<IServerEntryPoint>();
|
||||||
RunEntryPoints(entryPoints, true);
|
|
||||||
|
var now = DateTime.UtcNow;
|
||||||
|
await Task.WhenAll(StartEntryPoints(entryPoints, true));
|
||||||
|
Logger.LogInformation("Executed all pre-startup entry points in {Elapsed:fff} ms", DateTime.Now - now);
|
||||||
|
|
||||||
Logger.LogInformation("Core startup complete");
|
Logger.LogInformation("Core startup complete");
|
||||||
HttpServer.GlobalResponse = null;
|
HttpServer.GlobalResponse = null;
|
||||||
|
|
||||||
Logger.LogInformation("Post-init migrations complete");
|
now = DateTime.UtcNow;
|
||||||
|
await Task.WhenAll(StartEntryPoints(entryPoints, false));
|
||||||
RunEntryPoints(entryPoints, false);
|
Logger.LogInformation("Executed all post-startup entry points in {Elapsed:fff} ms", DateTime.Now - now);
|
||||||
Logger.LogInformation("All entry points have started");
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RunEntryPoints(IEnumerable<IServerEntryPoint> entryPoints, bool isBeforeStartup)
|
private IEnumerable<Task> StartEntryPoints(IEnumerable<IServerEntryPoint> entryPoints, bool isBeforeStartup)
|
||||||
{
|
{
|
||||||
foreach (var entryPoint in entryPoints)
|
foreach (var entryPoint in entryPoints)
|
||||||
{
|
{
|
||||||
|
@ -687,18 +689,9 @@ namespace Emby.Server.Implementations
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var name = entryPoint.GetType().FullName;
|
Logger.LogDebug("Starting entry point {Type}", entryPoint.GetType());
|
||||||
Logger.LogInformation("Starting entry point {Name}", name);
|
|
||||||
var now = DateTime.UtcNow;
|
yield return entryPoint.RunAsync();
|
||||||
try
|
|
||||||
{
|
|
||||||
entryPoint.Run();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.LogError(ex, "Error while running entrypoint {Name}", name);
|
|
||||||
}
|
|
||||||
Logger.LogInformation("Entry point completed: {Name}. Duration: {Duration} seconds", name, (DateTime.UtcNow - now).TotalSeconds.ToString(CultureInfo.InvariantCulture), "ImageInfos");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -353,7 +353,7 @@ namespace Emby.Server.Implementations.Collections
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Run()
|
public async Task RunAsync()
|
||||||
{
|
{
|
||||||
if (!_config.Configuration.CollectionsUpgraded && _config.Configuration.IsStartupWizardCompleted)
|
if (!_config.Configuration.CollectionsUpgraded && _config.Configuration.IsStartupWizardCompleted)
|
||||||
{
|
{
|
||||||
|
|
|
@ -425,7 +425,7 @@ namespace Emby.Server.Implementations.Devices
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Run()
|
public async Task RunAsync()
|
||||||
{
|
{
|
||||||
if (!_config.Configuration.CameraUploadUpgraded && _config.Configuration.IsStartupWizardCompleted)
|
if (!_config.Configuration.CameraUploadUpgraded && _config.Configuration.IsStartupWizardCompleted)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,12 +37,14 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
_timerFactory = timerFactory;
|
_timerFactory = timerFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
if (_appHost.CanSelfRestart)
|
if (_appHost.CanSelfRestart)
|
||||||
{
|
{
|
||||||
_appHost.HasPendingRestartChanged += _appHost_HasPendingRestartChanged;
|
_appHost.HasPendingRestartChanged += _appHost_HasPendingRestartChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _appHost_HasPendingRestartChanged(object sender, EventArgs e)
|
void _appHost_HasPendingRestartChanged(object sender, EventArgs e)
|
||||||
|
|
|
@ -61,17 +61,17 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
return string.Join("|", values.ToArray());
|
return string.Join("|", values.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
void _config_ConfigurationUpdated(object sender, EventArgs e)
|
private async void _config_ConfigurationUpdated(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!string.Equals(_lastConfigIdentifier, GetConfigIdentifier(), StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(_lastConfigIdentifier, GetConfigIdentifier(), StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
DisposeNat();
|
DisposeNat();
|
||||||
|
|
||||||
Run();
|
await RunAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
if (_config.Configuration.EnableUPnP && _config.Configuration.EnableRemoteAccess)
|
if (_config.Configuration.EnableUPnP && _config.Configuration.EnableRemoteAccess)
|
||||||
{
|
{
|
||||||
|
@ -80,6 +80,8 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
|
|
||||||
_config.ConfigurationUpdated -= _config_ConfigurationUpdated;
|
_config.ConfigurationUpdated -= _config_ConfigurationUpdated;
|
||||||
_config.ConfigurationUpdated += _config_ConfigurationUpdated;
|
_config.ConfigurationUpdated += _config_ConfigurationUpdated;
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Controller.Channels;
|
using MediaBrowser.Controller.Channels;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
|
@ -65,7 +66,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
_providerManager = providerManager;
|
_providerManager = providerManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
_libraryManager.ItemAdded += libraryManager_ItemAdded;
|
_libraryManager.ItemAdded += libraryManager_ItemAdded;
|
||||||
_libraryManager.ItemUpdated += libraryManager_ItemUpdated;
|
_libraryManager.ItemUpdated += libraryManager_ItemUpdated;
|
||||||
|
@ -74,6 +75,8 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
_providerManager.RefreshCompleted += _providerManager_RefreshCompleted;
|
_providerManager.RefreshCompleted += _providerManager_RefreshCompleted;
|
||||||
_providerManager.RefreshStarted += _providerManager_RefreshStarted;
|
_providerManager.RefreshStarted += _providerManager_RefreshStarted;
|
||||||
_providerManager.RefreshProgress += _providerManager_RefreshProgress;
|
_providerManager.RefreshProgress += _providerManager_RefreshProgress;
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<Guid, DateTime> _lastProgressMessageTimes = new Dictionary<Guid, DateTime>();
|
private Dictionary<Guid, DateTime> _lastProgressMessageTimes = new Dictionary<Guid, DateTime>();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.LiveTv;
|
using MediaBrowser.Controller.LiveTv;
|
||||||
using MediaBrowser.Controller.Plugins;
|
using MediaBrowser.Controller.Plugins;
|
||||||
|
@ -24,12 +25,14 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
_liveTvManager = liveTvManager;
|
_liveTvManager = liveTvManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
_liveTvManager.TimerCancelled += _liveTvManager_TimerCancelled;
|
_liveTvManager.TimerCancelled += _liveTvManager_TimerCancelled;
|
||||||
_liveTvManager.SeriesTimerCancelled += _liveTvManager_SeriesTimerCancelled;
|
_liveTvManager.SeriesTimerCancelled += _liveTvManager_SeriesTimerCancelled;
|
||||||
_liveTvManager.TimerCreated += _liveTvManager_TimerCreated;
|
_liveTvManager.TimerCreated += _liveTvManager_TimerCreated;
|
||||||
_liveTvManager.SeriesTimerCreated += _liveTvManager_SeriesTimerCreated;
|
_liveTvManager.SeriesTimerCreated += _liveTvManager_SeriesTimerCreated;
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _liveTvManager_SeriesTimerCreated(object sender, MediaBrowser.Model.Events.GenericEventArgs<TimerEventInfo> e)
|
private void _liveTvManager_SeriesTimerCreated(object sender, MediaBrowser.Model.Events.GenericEventArgs<TimerEventInfo> e)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.Plugins;
|
using MediaBrowser.Common.Plugins;
|
||||||
using MediaBrowser.Common.Updates;
|
using MediaBrowser.Common.Updates;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
|
@ -49,7 +50,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
_sessionManager = sessionManager;
|
_sessionManager = sessionManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
_userManager.UserDeleted += userManager_UserDeleted;
|
_userManager.UserDeleted += userManager_UserDeleted;
|
||||||
_userManager.UserUpdated += userManager_UserUpdated;
|
_userManager.UserUpdated += userManager_UserUpdated;
|
||||||
|
@ -65,6 +66,8 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
_installationManager.PackageInstallationFailed += _installationManager_PackageInstallationFailed;
|
_installationManager.PackageInstallationFailed += _installationManager_PackageInstallationFailed;
|
||||||
|
|
||||||
_taskManager.TaskCompleted += _taskManager_TaskCompleted;
|
_taskManager.TaskCompleted += _taskManager_TaskCompleted;
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _installationManager_PackageInstalling(object sender, InstallationEventArgs e)
|
void _installationManager_PackageInstalling(object sender, InstallationEventArgs e)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Emby.Server.Implementations.Browser;
|
using Emby.Server.Implementations.Browser;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
|
@ -32,11 +33,11 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs this instance.
|
/// Runs this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Run()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
if (!_appHost.CanLaunchWebBrowser)
|
if (!_appHost.CanLaunchWebBrowser)
|
||||||
{
|
{
|
||||||
return;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_config.Configuration.IsStartupWizardCompleted)
|
if (!_config.Configuration.IsStartupWizardCompleted)
|
||||||
|
@ -52,6 +53,8 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
BrowserLauncher.OpenWebApp(_appHost);
|
BrowserLauncher.OpenWebApp(_appHost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Emby.Server.Implementations.Udp;
|
using Emby.Server.Implementations.Udp;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Plugins;
|
using MediaBrowser.Controller.Plugins;
|
||||||
|
@ -43,7 +44,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs this instance.
|
/// Runs this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Run()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
var udpServer = new UdpServer(_logger, _appHost, _json, _socketFactory);
|
var udpServer = new UdpServer(_logger, _appHost, _json, _socketFactory);
|
||||||
|
|
||||||
|
@ -57,6 +58,8 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Failed to start UDP Server");
|
_logger.LogError(ex, "Failed to start UDP Server");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -38,9 +38,11 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
_timerFactory = timerFactory;
|
_timerFactory = timerFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
_userDataManager.UserDataSaved += _userDataManager_UserDataSaved;
|
_userDataManager.UserDataSaved += _userDataManager_UserDataSaved;
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _userDataManager_UserDataSaved(object sender, UserDataSaveEventArgs e)
|
void _userDataManager_UserDataSaved(object sender, UserDataSaveEventArgs e)
|
||||||
|
|
|
@ -633,9 +633,10 @@ namespace Emby.Server.Implementations.IO
|
||||||
_monitor = monitor;
|
_monitor = monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
_monitor.Start();
|
_monitor.Start();
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
|
@ -1182,9 +1182,11 @@ namespace Emby.Server.Implementations.Library
|
||||||
_sessionManager = sessionManager;
|
_sessionManager = sessionManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
_userManager.UserPolicyUpdated += _userManager_UserPolicyUpdated;
|
_userManager.UserPolicyUpdated += _userManager_UserPolicyUpdated;
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _userManager_UserPolicyUpdated(object sender, GenericEventArgs<User> e)
|
private void _userManager_UserPolicyUpdated(object sender, GenericEventArgs<User> e)
|
||||||
|
|
|
@ -123,7 +123,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Start()
|
public async Task Start()
|
||||||
{
|
{
|
||||||
_timerProvider.RestartTimers();
|
_timerProvider.RestartTimers();
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Controller.Plugins;
|
using MediaBrowser.Controller.Plugins;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
{
|
{
|
||||||
public class EntryPoint : IServerEntryPoint
|
public class EntryPoint : IServerEntryPoint
|
||||||
{
|
{
|
||||||
public void Run()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
EmbyTV.Current.Start();
|
return EmbyTV.Current.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
|
@ -118,8 +118,6 @@ namespace Jellyfin.Server
|
||||||
|
|
||||||
appHost.ImageProcessor.ImageEncoder = GetImageEncoder(fileSystem, appPaths, appHost.LocalizationManager);
|
appHost.ImageProcessor.ImageEncoder = GetImageEncoder(fileSystem, appPaths, appHost.LocalizationManager);
|
||||||
|
|
||||||
_logger.LogInformation("Running startup tasks");
|
|
||||||
|
|
||||||
await appHost.RunStartupTasks();
|
await appHost.RunStartupTasks();
|
||||||
|
|
||||||
// TODO: read input for a stop command
|
// TODO: read input for a stop command
|
||||||
|
@ -133,8 +131,6 @@ namespace Jellyfin.Server
|
||||||
{
|
{
|
||||||
// Don't throw on cancellation
|
// Don't throw on cancellation
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Disposing app host");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_restartOnShutdown)
|
if (_restartOnShutdown)
|
||||||
|
|
|
@ -130,7 +130,7 @@ namespace MediaBrowser.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs this instance.
|
/// Runs this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Run()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -148,6 +148,8 @@ namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
Logger.LogError(ex, "Error deleting encoded media cache");
|
Logger.LogError(ex, "Error deleting encoded media cache");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EncodingOptions GetEncodingOptions()
|
public EncodingOptions GetEncodingOptions()
|
||||||
|
@ -162,8 +164,7 @@ namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
var path = _config.ApplicationPaths.TranscodingTempPath;
|
var path = _config.ApplicationPaths.TranscodingTempPath;
|
||||||
|
|
||||||
foreach (var file in _fileSystem.GetFilePaths(path, true)
|
foreach (var file in _fileSystem.GetFilePaths(path, true))
|
||||||
.ToList())
|
|
||||||
{
|
{
|
||||||
_fileSystem.DeleteFile(file);
|
_fileSystem.DeleteFile(file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Plugins
|
namespace MediaBrowser.Controller.Plugins
|
||||||
{
|
{
|
||||||
|
@ -10,7 +11,7 @@ namespace MediaBrowser.Controller.Plugins
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs this instance.
|
/// Runs this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Run();
|
Task RunAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IRunBeforeStartup
|
public interface IRunBeforeStartup
|
||||||
|
|
|
@ -425,11 +425,9 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
private async Task DumpFile(PackageCreator packageCreator, string resourceVirtualPath, string destinationFilePath, string mode, string appVersion)
|
private async Task DumpFile(PackageCreator packageCreator, string resourceVirtualPath, string destinationFilePath, string mode, string appVersion)
|
||||||
{
|
{
|
||||||
using (var stream = await packageCreator.GetResource(resourceVirtualPath, mode, null, appVersion).ConfigureAwait(false))
|
using (var stream = await packageCreator.GetResource(resourceVirtualPath, mode, null, appVersion).ConfigureAwait(false))
|
||||||
|
using (var fs = _fileSystem.GetFileStream(destinationFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
|
||||||
{
|
{
|
||||||
using (var fs = _fileSystem.GetFileStream(destinationFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
|
await stream.CopyToAsync(fs);
|
||||||
{
|
|
||||||
stream.CopyTo(fs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common;
|
using MediaBrowser.Common;
|
||||||
using MediaBrowser.Controller.Plugins;
|
using MediaBrowser.Controller.Plugins;
|
||||||
|
|
||||||
|
@ -23,9 +24,11 @@ namespace MediaBrowser.WebDashboard
|
||||||
Instance = this;
|
Instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
PluginConfigurationPages = _appHost.GetExports<IPluginConfigurationPage>().ToList();
|
PluginConfigurationPages = _appHost.GetExports<IPluginConfigurationPage>().ToList();
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
@ -28,9 +29,11 @@ namespace MediaBrowser.XbmcMetadata
|
||||||
_config = config;
|
_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
_userDataManager.UserDataSaved += _userDataManager_UserDataSaved;
|
_userDataManager.UserDataSaved += _userDataManager_UserDataSaved;
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _userDataManager_UserDataSaved(object sender, UserDataSaveEventArgs e)
|
void _userDataManager_UserDataSaved(object sender, UserDataSaveEventArgs e)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user