예제 #1
0
        private static void StartReader()
        {
            _logger.Info(() => "starting the reader");
            while (true)
            {
                var sw = new Stopwatch();
                sw.Start();
                var items = RunQueue();
                sw.Stop();

                if (items != 0 && sw.ElapsedMilliseconds != 0)
                {
                    lock (_flushFrequencyLockerObject) {
                        _analyzedRequestsFrequency = (0.2 * _analyzedRequestsFrequency) + 0.8 * (double)items / sw.Elapsed.TotalSeconds;
                    }
                }

                Thread.Sleep(_writeInterval);
                UpdateBufferFlushFrequency();
            }
        }