private void PurgeTimedOutRequests()
 {
     if (_doNotTimeout)
     {
         return;
     }
     try {
         while (_pending.Count > 0)
         {
             var req = _pending.FindMin();
             if (req.Item1 <= DateTime.UtcNow || req.Item2.IsProcessing)
             {
                 req = _pending.DeleteMin();
                 req.Item2.ReplyStatus(HttpStatusCode.RequestTimeout,
                                       "Server was unable to handle request in time",
                                       e => Log.Debug(
                                           "Error occurred while closing timed out connection (HTTP service core): {e}.",
                                           e.Message));
             }
             else
             {
                 break;
             }
         }
     } catch (Exception exc) {
         Log.ErrorException(exc, "Error purging timed out requests in HTTP request processor.");
     }
 }
Exemplo n.º 2
0
        public IEnumerable <OutstandingMessage> GetMessagesExpiringBefore(DateTime time)
        {
            while (_byTime.Count > 0 && _byTime.FindMin().DueTime <= time)
            {
                var item = _byTime.DeleteMin();
                OutstandingMessage m;
                if (_outstandingRequests.TryGetValue(item.MessageId, out m))
                {
                    yield return(_outstandingRequests[item.MessageId]);

                    _outstandingRequests.Remove(item.MessageId);
                    _bySequences.Remove(m.ResolvedEvent.OriginalEventNumber);
                }
            }
        }
Exemplo n.º 3
0
 public void throw_invalidoperationexception_when_trying_to_find_min_element_on_empty_queue()
 {
     Assert.Throws <InvalidOperationException>(() => _heap.FindMin());
 }
Exemplo n.º 4
0
 public void throw_invalidoperationexception_when_trying_to_find_min_element_on_empty_queue()
 {
     var x = _heap.FindMin();
 }