update realtime monitor

This commit is contained in:
Luke Pulverenti
2017-05-27 03:19:09 -04:00
parent 89ba154522
commit ffb68b0318
8 changed files with 50 additions and 32 deletions

View File

@@ -87,8 +87,9 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp
private void ProcessContext(HttpListenerContext context)
{
//Task.Factory.StartNew(() => InitTask(context), TaskCreationOptions.DenyChildAttach | TaskCreationOptions.PreferFairness);
Task.Run(() => InitTask(context, _disposeCancellationToken));
_logger.Info("thread id {0}", Thread.CurrentThread.ManagedThreadId);
InitTask(context, _disposeCancellationToken);
//Task.Run(() => InitTask(context, _disposeCancellationToken));
}
private Task InitTask(HttpListenerContext context, CancellationToken cancellationToken)

View File

@@ -180,7 +180,7 @@ namespace Emby.Server.Implementations.IO
try
{
await item.ChangedExternally().ConfigureAwait(false);
item.ChangedExternally();
}
catch (IOException ex)
{
@@ -282,11 +282,11 @@ namespace Emby.Server.Implementations.IO
return false;
}
}
//catch (DirectoryNotFoundException)
//{
// // File may have been deleted
// return false;
//}
catch (DirectoryNotFoundException)
{
// File may have been deleted
return false;
}
catch (FileNotFoundException)
{
// File may have been deleted

View File

@@ -66,19 +66,19 @@ namespace Emby.Server.Implementations.Session
return SendMessage(name, new Dictionary<string, string>(), cancellationToken);
}
private async Task SendMessage(string name,
private Task SendMessage(string name,
Dictionary<string, string> args,
CancellationToken cancellationToken)
{
var url = PostUrl + "/" + name + ToQueryString(args);
await _httpClient.Post(new HttpRequestOptions
return _httpClient.Post(new HttpRequestOptions
{
Url = url,
CancellationToken = cancellationToken,
BufferContent = false
}).ConfigureAwait(false);
});
}
public Task SendSessionEndedNotification(SessionInfoDto sessionInfo, CancellationToken cancellationToken)
@@ -159,8 +159,24 @@ namespace Emby.Server.Implementations.Session
public Task SendMessage<T>(string name, T data, CancellationToken cancellationToken)
{
// Not supported or needed right now
return Task.FromResult(true);
var url = PostUrl + "/" + name;
var options = new HttpRequestOptions
{
Url = url,
CancellationToken = cancellationToken,
BufferContent = false
};
options.RequestContent = _json.SerializeToString(data);
options.RequestContentType = "application/json";
return _httpClient.Post(new HttpRequestOptions
{
Url = url,
CancellationToken = cancellationToken,
BufferContent = false
});
}
private string ToQueryString(Dictionary<string, string> nvc)