private async Task EnsureSyncJobItems(string targetId, CancellationToken cancellationToken) { var jobResult = _syncRepo.GetJobs(new SyncJobQuery { SyncNewContent = true, TargetId = targetId }); foreach (var job in jobResult.Items) { cancellationToken.ThrowIfCancellationRequested(); if (job.SyncNewContent) { var user = _userManager.GetUserById(job.UserId); if (user == null) { await _syncManager.CancelJob(job.Id).ConfigureAwait(false); } else { await EnsureJobItems(job, user).ConfigureAwait(false); } } } }
public QueryResult <SyncJob> GetJobs(SyncJobQuery query) { var result = _repo.GetJobs(query); result.Items.ForEach(FillMetadata); return(result); }
public async Task <QueryResult <SyncJob> > GetJobs(SyncJobQuery query) { var result = _repo.GetJobs(query); foreach (var item in result.Items) { await FillMetadata(item).ConfigureAwait(false); } return(result); }
public async Task EnsureSyncJobs(CancellationToken cancellationToken) { var jobResult = _syncRepo.GetJobs(new SyncJobQuery { IsCompleted = false }); foreach (var job in jobResult.Items) { cancellationToken.ThrowIfCancellationRequested(); if (job.SyncNewContent) { await EnsureJobItems(job).ConfigureAwait(false); } } }
private async Task EnsureSyncJobItems(string targetId, CancellationToken cancellationToken) { var jobResult = _syncRepo.GetJobs(new SyncJobQuery { SyncNewContent = true, TargetId = targetId }); foreach (var job in jobResult.Items) { cancellationToken.ThrowIfCancellationRequested(); if (job.SyncNewContent) { await EnsureJobItems(job).ConfigureAwait(false); } } }