コード例 #1
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            while (!stoppingToken.IsCancellationRequested)
            {
                await _dateTimeService.WaitToTomorrow(stoppingToken);

                var userStates = await _userStateRepository.GetSubscribedUsers(stoppingToken);

                var eventInfos = await _eventsRepository.GetEvents(DateTime.UtcNow.DayOfWeek, stoppingToken);

                if (eventInfos.Count == 0)
                {
                    return;
                }

                var notifies = GetNotifies(userStates, eventInfos);
                await SendNotifies(stoppingToken, notifies);
            }
        }