Ejemplo n.º 1
0
        /// <summary>
        /// This is excuted in separate thread
        /// </summary>
        /// <returns></returns>
        private async Task DoMonitorAsync()
        {
            // Still there are too many emails in the queue => Ignore
            if (_emailContentQueue.Count < 1000)
            {
                _timer.Stop();
                var emails = await _mailRepository.GetNotCheckedEmailsAsync();

                emails.ToList().ForEach(s =>
                {
                    if (_emailContentQueue.All(t => t.EmailContentID != s.EmailContentID))
                    {
                        _emailContentQueue.Enqueue(s);
                        EnqueueProgress.Report(s);
                    }
                });
                _timer.Start();
            }
        }