diff options
| author | David <daullmer@gmail.com> | 2020-12-23 19:24:58 +0100 |
|---|---|---|
| committer | David <daullmer@gmail.com> | 2020-12-23 19:24:58 +0100 |
| commit | 2a574914eaca486f6216db400d9fdf88ad88636e (patch) | |
| tree | 760b7c769e71cfd88ff54282622a704143bb2b4f /Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs | |
| parent | f38970cbd32c845d1740828450aac8de16fec788 (diff) | |
Use streams instead of strings
Diffstat (limited to 'Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs')
| -rw-r--r-- | Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs index eee7aeea3..a9f459986 100644 --- a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs +++ b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs @@ -139,15 +139,8 @@ namespace Emby.Server.Implementations.ScheduledTasks { try { - 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); - } + using FileStream jsonStream = File.OpenRead(path); + _lastExecutionResult = JsonSerializer.DeserializeAsync<TaskResult>(jsonStream, JsonDefaults.GetOptions()).GetAwaiter().GetResult(); } catch (Exception ex) { |
