Merge pull request #2370 from MediaBrowser/dev

add sync error handling
This commit is contained in:
Luke 2016-12-28 14:56:37 -05:00 committed by GitHub
commit 4ab4442b88
2 changed files with 9 additions and 6 deletions

View File

@ -515,8 +515,14 @@ namespace Emby.Server.Implementations.Sync
jobItem.Progress = 0; jobItem.Progress = 0;
var syncOptions = _config.GetSyncOptions();
var job = _syncManager.GetJob(jobItem.JobId); var job = _syncManager.GetJob(jobItem.JobId);
if (job == null)
{
_logger.Error("Job not found. Cannot complete the sync job.");
await _syncManager.CancelJobItem(jobItem.Id).ConfigureAwait(false);
return;
}
var user = _userManager.GetUserById(job.UserId); var user = _userManager.GetUserById(job.UserId);
if (user == null) if (user == null)
{ {
@ -552,6 +558,8 @@ namespace Emby.Server.Implementations.Sync
} }
} }
var syncOptions = _config.GetSyncOptions();
var video = item as Video; var video = item as Video;
if (video != null) if (video != null)
{ {

View File

@ -1049,11 +1049,6 @@ namespace Emby.Server.Implementations.Sync
{ {
var jobItem = _repo.GetJobItem(id); var jobItem = _repo.GetJobItem(id);
if (jobItem.Status != SyncJobItemStatus.Queued && jobItem.Status != SyncJobItemStatus.ReadyToTransfer && jobItem.Status != SyncJobItemStatus.Converting && jobItem.Status != SyncJobItemStatus.Failed && jobItem.Status != SyncJobItemStatus.Synced && jobItem.Status != SyncJobItemStatus.Transferring)
{
throw new ArgumentException("Operation is not valid for this job item");
}
jobItem.Status = SyncJobItemStatus.Cancelled; jobItem.Status = SyncJobItemStatus.Cancelled;
jobItem.Progress = 0; jobItem.Progress = 0;