reduce work done by system info endpoints

This commit is contained in:
Luke Pulverenti
2017-12-01 12:03:40 -05:00
parent 5ca1b96c6f
commit d7a1a87009
9 changed files with 38 additions and 38 deletions

View File

@@ -151,7 +151,7 @@ namespace Emby.Server.Implementations.Session
return SendMessage("LibraryChanged", info, cancellationToken);
}
public Task SendRestartRequiredNotification(SystemInfo info, CancellationToken cancellationToken)
public Task SendRestartRequiredNotification(CancellationToken cancellationToken)
{
return SendMessage("RestartRequired", cancellationToken);
}

View File

@@ -1182,13 +1182,11 @@ namespace Emby.Server.Implementations.Session
{
var sessions = Sessions.Where(i => i.IsActive && i.SessionController != null).ToList();
var info = await _appHost.GetSystemInfo(cancellationToken).ConfigureAwait(false);
var tasks = sessions.Select(session => Task.Run(async () =>
{
try
{
await session.SessionController.SendRestartRequiredNotification(info, cancellationToken).ConfigureAwait(false);
await session.SessionController.SendRestartRequiredNotification(cancellationToken).ConfigureAwait(false);
}
catch (Exception ex)
{

View File

@@ -145,12 +145,12 @@ namespace Emby.Server.Implementations.Session
/// <param name="info">The information.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
public Task SendRestartRequiredNotification(SystemInfo info, CancellationToken cancellationToken)
public Task SendRestartRequiredNotification(CancellationToken cancellationToken)
{
return SendMessagesInternal(new WebSocketMessage<SystemInfo>
return SendMessagesInternal(new WebSocketMessage<string>
{
MessageType = "RestartRequired",
Data = info
Data = string.Empty
}, cancellationToken);
}