clean up sync temp files when canceling jobs

This commit is contained in:
Luke Pulverenti
2015-02-03 13:55:15 -05:00
parent 7fd4b97481
commit 0f88525d61
3 changed files with 43 additions and 6 deletions

View File

@@ -309,6 +309,17 @@ namespace MediaBrowser.Server.Implementations.Sync
await _repo.DeleteJob(id).ConfigureAwait(false);
var path = GetSyncJobProcessor().GetTemporaryPath(id);
try
{
_fileSystem.DeleteDirectory(path, true);
}
catch (Exception ex)
{
_logger.ErrorException("Error deleting directory {0}", ex, path);
}
if (SyncJobCancelled != null)
{
EventHelper.FireEventIfNotNull(SyncJobCancelled, this, new GenericEventArgs<SyncJob>
@@ -706,6 +717,17 @@ namespace MediaBrowser.Server.Implementations.Sync
var processor = GetSyncJobProcessor();
await processor.UpdateJobStatus(jobItem.JobId).ConfigureAwait(false);
var path = processor.GetTemporaryPath(jobItem);
try
{
_fileSystem.DeleteDirectory(path, true);
}
catch (Exception ex)
{
_logger.ErrorException("Error deleting directory {0}", ex, path);
}
}
public async Task MarkJobItemForRemoval(string id)