3.0.5518.5

This commit is contained in:
Luke Pulverenti
2015-02-19 12:46:18 -05:00
parent d451386f5d
commit f2c3dade77
7 changed files with 34 additions and 13 deletions

View File

@@ -82,7 +82,7 @@ namespace MediaBrowser.Server.Implementations.Sync
IProgress<double> progress,
CancellationToken cancellationToken)
{
var jobItems = _syncManager.GetReadySyncItems(target.Id);
var jobItems = await _syncManager.GetReadySyncItems(target.Id).ConfigureAwait(false);
var numComplete = 0;
double startingPercent = 0;

View File

@@ -336,11 +336,12 @@ namespace MediaBrowser.Server.Implementations.Sync
return new[] { item };
}
public async Task EnsureSyncJobItems(CancellationToken cancellationToken)
private async Task EnsureSyncJobItems(string targetId, CancellationToken cancellationToken)
{
var jobResult = _syncRepo.GetJobs(new SyncJobQuery
{
SyncNewContent = true
SyncNewContent = true,
TargetId = targetId
});
foreach (var job in jobResult.Items)
@@ -356,7 +357,7 @@ namespace MediaBrowser.Server.Implementations.Sync
public async Task Sync(IProgress<double> progress, CancellationToken cancellationToken)
{
await EnsureSyncJobItems(cancellationToken).ConfigureAwait(false);
await EnsureSyncJobItems(null, cancellationToken).ConfigureAwait(false);
// If it already has a converting status then is must have been aborted during conversion
var result = _syncRepo.GetJobItems(new SyncJobItemQuery
@@ -375,6 +376,21 @@ namespace MediaBrowser.Server.Implementations.Sync
// Clean files in sync temp folder that are not linked to any sync jobs
}
public async Task SyncJobItems(string targetId, bool enableConversion, IProgress<double> progress,
CancellationToken cancellationToken)
{
await EnsureSyncJobItems(targetId, cancellationToken).ConfigureAwait(false);
// If it already has a converting status then is must have been aborted during conversion
var result = _syncRepo.GetJobItems(new SyncJobItemQuery
{
Statuses = new List<SyncJobItemStatus> { SyncJobItemStatus.Queued, SyncJobItemStatus.Converting },
TargetId = targetId
});
await SyncJobItems(result.Items, true, progress, cancellationToken).ConfigureAwait(false);
}
public async Task SyncJobItems(SyncJobItem[] items, bool enableConversion, IProgress<double> progress, CancellationToken cancellationToken)
{
if (items.Length > 0)

View File

@@ -695,8 +695,12 @@ namespace MediaBrowser.Server.Implementations.Sync
return _userDataManager.SaveUserData(new Guid(action.UserId), item, userData, UserDataSaveReason.Import, CancellationToken.None);
}
public List<SyncedItem> GetReadySyncItems(string targetId)
public async Task<List<SyncedItem>> GetReadySyncItems(string targetId)
{
var processor = GetSyncJobProcessor();
await processor.SyncJobItems(targetId, false, new Progress<double>(), CancellationToken.None).ConfigureAwait(false);
var jobItemResult = GetJobItems(new SyncJobItemQuery
{
TargetId = targetId,