Exemplo n.º 1
0
        protected virtual void QueryStorage()
        {
            _lastQueryTimeUtc            = DateTime.UtcNow;
            _isLastQueryMaxItemsReceived = false;

            Stopwatch storageQueryTimer = Stopwatch.StartNew();

            List <SignalEvent <TKey> > items = null;

            try
            {
                items = _eventQueries
                        .Find(ItemsQueryCount, MaxFailedAttempts)
                        .Result;
            }
            catch (Exception ex)
            {
                items = new List <SignalEvent <TKey> >();
                _logger.LogError(ex, SenderInternalMessages.DatabaseEventProvider_DatabaseError);
            }

            _monitor.EventPersistentStorageQueried(storageQueryTimer.Elapsed, items);

            _isLastQueryMaxItemsReceived = items.Count == ItemsQueryCount;
            if (_changeNotifier != null && _isLastQueryMaxItemsReceived == false)
            {
                _changeNotifier.StartMonitor();
            }

            _eventQueue.Append(items, true);
        }