Use sync string instead of file

This commit is contained in:
David
2020-12-24 10:31:51 +01:00
parent a714008b59
commit e835dfb27d
4 changed files with 17 additions and 9 deletions

View File

@@ -139,8 +139,15 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
try
{
using FileStream jsonStream = File.OpenRead(path);
_lastExecutionResult = JsonSerializer.DeserializeAsync<TaskResult>(jsonStream, JsonDefaults.GetOptions()).GetAwaiter().GetResult();
var jsonString = File.ReadAllText(path);
if (!string.IsNullOrWhiteSpace(jsonString))
{
_lastExecutionResult = JsonSerializer.Deserialize<TaskResult>(jsonString, JsonDefaults.GetOptions());
}
else
{
_logger.LogDebug("Scheduled Task history file {path} is empty. Skipping deserialization.", path);
}
}
catch (Exception ex)
{