Commit 04d3ab0a authored by Marc Gravell's avatar Marc Gravell

Tweak name from `PeekPing` to `DequeueUnsentPing`, to better reflect what it...

Tweak name from `PeekPing` to `DequeueUnsentPing`, to better reflect what it is doing; fix the remaining count accordingly
parent 03060353
......@@ -27,20 +27,25 @@ public Message Dequeue()
return null;
}
public Message PeekPing(out int queueLength)
/// <summary>
/// Checks both high-pri and regular queues to see if the next item is a PING, and if so: dequeues it and returns it
/// </summary>
public Message DequeueUnsentPing(out int queueLength)
{
lock (regular)
{
Message peeked;
queueLength = high.Count + regular.Count;
//In a disconnect scenario, we don't want to complete the Ping message twice,
//dequeue it now so it wont get dequeued in AbortUnsent (if we're going down that code path)
if (high.Count != 0 && (peeked = high.Peek()).Command == RedisCommand.PING)
{
//In a disconnect scenario, we don't want to complete the Ping message twice,
//dequeue it now so it wont get dequeued in AbortUnsent (if we're going down that code path)
queueLength--;
return high.Dequeue();
}
if (regular.Count != 0 && (peeked = regular.Peek()).Command == RedisCommand.PING)
{
queueLength--;
return regular.Dequeue();
}
}
......
......@@ -316,7 +316,7 @@ internal void OnDisconnected(ConnectionFailureType failureType, PhysicalConnecti
// if the next thing in the pipe is a PING, we can tell it that we failed (this really helps spot doomed connects)
int count;
var ping = queue.PeekPing(out count);
var ping = queue.DequeueUnsentPing(out count);
if (ping != null)
{
Trace("Marking PING as failed (queue length: " + count + ")");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment