示例#1
0
 public void Start()
 {
     if(!_pulse.Enabled)
     {
         _results = new AggregatedResults();
         _pulse.Start();
     }
 }
示例#2
0
        private void Pulse(object sender, ElapsedEventArgs e)
        {
            lock (_summaryLock)
            {
                // Generate and send a notification summarising what we've got stored
                StringBuilder notification = new StringBuilder($"I've harvested {_results.TotalItemsHarvested} results from {_results.TotalSearchesRan} searches in the last {_reportingPeriod} minutes\n");

                foreach (var condition in _results.ConditionalTotals)
                {
                    notification.Append($" {condition.Key} - {condition.Value.Total} total, {condition.Value.Suspicious} suspicious\n");
                }

                _notifier.PostMessage(notification.ToString());

                // Then reset the aggregate object
                _results = new AggregatedResults();
            }
        }