Esempio n. 1
0
        public RequestQueueBucket(RequestQueue queue, Bucket definition, RequestQueueBucket parent = null)
        {
            _queue     = queue;
            Definition = definition;
            if (definition.WindowCount != 0)
            {
                _semaphore = new SemaphoreSlim(definition.WindowCount, definition.WindowCount);
            }
            Parent = parent;

            _pauseLock      = new object();
            _resumeNotifier = new TaskCompletionSource <byte>();
            _resumeNotifier.SetResult(0);
        }
Esempio n. 2
0
 private bool FindBucket(string id, out RequestQueueBucket bucket)
 {
     //Keep going up until we find a bucket with matching id or we're at the topmost bucket
     if (Definition.Id == id)
     {
         bucket = this;
         return(true);
     }
     else if (Parent == null)
     {
         bucket = this;
         return(false);
     }
     else
     {
         return(Parent.FindBucket(id, out bucket));
     }
 }