Exemple #1
0
        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);
                    }
                }
            }
        }
Exemple #2
0
        public QueryResult <SyncJob> GetJobs(SyncJobQuery query)
        {
            var result = _repo.GetJobs(query);

            result.Items.ForEach(FillMetadata);

            return(result);
        }
Exemple #3
0
        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);
                }
            }
        }
Exemple #5
0
        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);
                }
            }
        }