aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2015-04-14 00:43:41 -0400
committerLuke <luke.pulverenti@gmail.com>2015-04-14 00:43:41 -0400
commit935de313d58c7a7ba792345c16cfd1c1aad09a78 (patch)
tree2e9334986de5864b00d4901f031b5de6a970305e /MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
parent71a4f2761e784513ae2f3dda03aa549903808ebb (diff)
parentbd253399c2f1913c544c93fd6927dee37f8add2f (diff)
Merge pull request #1079 from MediaBrowser/dev
3.0.5582.0
Diffstat (limited to 'MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs')
-rw-r--r--MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs17
1 files changed, 10 insertions, 7 deletions
diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
index 78dcea493..c2551731f 100644
--- a/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
+++ b/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
@@ -121,12 +121,12 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
{
if (_lastExecutionResult == null)
{
+ var path = GetHistoryFilePath();
+
lock (_lastExecutionResultSyncLock)
{
if (_lastExecutionResult == null)
{
- var path = GetHistoryFilePath();
-
try
{
return JsonSerializer.DeserializeFromFile<TaskResult>(path);
@@ -152,6 +152,14 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
private set
{
_lastExecutionResult = value;
+
+ var path = GetHistoryFilePath();
+ Directory.CreateDirectory(Path.GetDirectoryName(path));
+
+ lock (_lastExecutionResultSyncLock)
+ {
+ JsonSerializer.SerializeToFile(value, path);
+ }
}
}
@@ -582,11 +590,6 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
result.LongErrorMessage = ex.StackTrace;
}
- var path = GetHistoryFilePath();
- Directory.CreateDirectory(Path.GetDirectoryName(path));
-
- JsonSerializer.SerializeToFile(result, path);
-
LastExecutionResult = result;
((TaskManager)TaskManager).OnTaskCompleted(this, result);