diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-12-30 16:14:21 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-12-30 16:14:21 -0500 |
| commit | 1dea300f6ba88d2d87110b91f8f15c015412794c (patch) | |
| tree | be9993319e041c76436b4b49c8183fec473a2f4a /Emby.Server.Implementations/Sync/SyncJobProcessor.cs | |
| parent | b8f57f586b218558bcb45259d65dfe990e593559 (diff) | |
handle non-existent user with sync jobs
Diffstat (limited to 'Emby.Server.Implementations/Sync/SyncJobProcessor.cs')
| -rw-r--r-- | Emby.Server.Implementations/Sync/SyncJobProcessor.cs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Emby.Server.Implementations/Sync/SyncJobProcessor.cs b/Emby.Server.Implementations/Sync/SyncJobProcessor.cs index b1adc64df..17cdef5fc 100644 --- a/Emby.Server.Implementations/Sync/SyncJobProcessor.cs +++ b/Emby.Server.Implementations/Sync/SyncJobProcessor.cs @@ -59,15 +59,8 @@ namespace Emby.Server.Implementations.Sync _mediaSourceManager = mediaSourceManager; } - public async Task EnsureJobItems(SyncJob job) + public async Task EnsureJobItems(SyncJob job, User user) { - var user = _userManager.GetUserById(job.UserId); - - if (user == null) - { - throw new InvalidOperationException("Cannot proceed with sync because user no longer exists."); - } - var items = (await GetItemsForSync(job.Category, job.ParentId, job.RequestedItemIds, user, job.UnwatchedOnly).ConfigureAwait(false)) .ToList(); @@ -385,7 +378,16 @@ namespace Emby.Server.Implementations.Sync if (job.SyncNewContent) { - await EnsureJobItems(job).ConfigureAwait(false); + var user = _userManager.GetUserById(job.UserId); + + if (user == null) + { + await _syncManager.CancelJob(job.Id).ConfigureAwait(false); + } + else + { + await EnsureJobItems(job, user).ConfigureAwait(false); + } } } } |
