Ejemplo n.º 1
0
        public Task <IEnumerable <MinimalLinkApplicationModel> > Handle(GetDoneRequestLinksByRequestIDAfterIDQuery query, CancellationToken cancellationToken)
        {
            IEnumerable <MinimalLinkApplicationModel> linksApplicationModels = _linkRepository
                                                                               .FindAll(x => x.RequestID == query.RequestID && x.ID > query.LinkID && x.Status == LinkStatus.Done)
                                                                               .OrderBy(x => x.ID)
                                                                               .Take(100)
                                                                               .ProjectTo <MinimalLinkApplicationModel>(_mapper.ConfigurationProvider)
                                                                               .ToList();

            return(Task.FromResult(linksApplicationModels));
        }
Ejemplo n.º 2
0
        private async Task SendUpdates()
        {
            using (var scope = _serviceScopeFactory.CreateScope()) {
                var logger   = scope.ServiceProvider.GetRequiredService <ILogger <IJobUpdaterService> >();
                var mediator = scope.ServiceProvider.GetRequiredService <IMediator>();

                foreach (var client in _clientsAccessor.Clients)
                {
                    var links = await mediator.Send(GetDoneRequestLinksByRequestIDAfterIDQuery.Build(client.RequestID, client.LastLinkID));

                    if (links.Count() > 0)
                    {
                        await client.Client.SendAsync("RetrieveUpdatedClients", links);

                        client.LastLinkID = links.Last().ID;
                    }
                }
            }
        }