Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
5b4fd382
Commit
5b4fd382
authored
Jul 02, 2018
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set the exception on a single message if ComputeResult *itself* fails
parent
7a2e6b56
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
121 deletions
+9
-121
Message.cs
StackExchange.Redis/StackExchange/Redis/Message.cs
+9
-1
MessageQueue.cs
StackExchange.Redis/StackExchange/Redis/MessageQueue.cs
+0
-120
No files found.
StackExchange.Redis/StackExchange/Redis/Message.cs
View file @
5b4fd382
...
...
@@ -582,7 +582,15 @@ internal void Cancel(Exception ex = null)
// true if ready to be completed (i.e. false if re-issued to another server)
internal
bool
ComputeResult
(
PhysicalConnection
connection
,
RawResult
result
)
{
return
resultProcessor
==
null
||
resultProcessor
.
SetResult
(
connection
,
this
,
result
);
try
{
return
resultProcessor
==
null
||
resultProcessor
.
SetResult
(
connection
,
this
,
result
);
}
catch
(
Exception
ex
)
{
resultBox
?.
SetException
(
ex
);
return
true
;
// we still want to pulse/complete
}
}
internal
void
Fail
(
ConnectionFailureType
failure
,
Exception
innerException
)
...
...
StackExchange.Redis/StackExchange/Redis/MessageQueue.cs
deleted
100644 → 0
View file @
7a2e6b56
using
System.Collections.Generic
;
using
System.Text
;
namespace
StackExchange.Redis
{
internal
sealed
partial
class
MessageQueue
{
private
readonly
Queue
<
Message
>
regular
=
new
Queue
<
Message
>(),
high
=
new
Queue
<
Message
>();
public
object
SyncLock
=>
regular
;
public
Message
Dequeue
()
{
lock
(
regular
)
{
if
(
high
.
Count
!=
0
)
{
return
high
.
Dequeue
();
}
if
(
regular
.
Count
!=
0
)
{
return
regular
.
Dequeue
();
}
}
return
null
;
}
/// <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>
/// <param name="queueLength">The current queue count.</param>
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
)
{
queueLength
--;
return
high
.
Dequeue
();
}
if
(
regular
.
Count
!=
0
&&
(
peeked
=
regular
.
Peek
()).
Command
==
RedisCommand
.
PING
)
{
queueLength
--;
return
regular
.
Dequeue
();
}
}
return
null
;
}
public
bool
Push
(
Message
message
)
{
lock
(
regular
)
{
(
message
.
IsHighPriority
?
high
:
regular
).
Enqueue
(
message
);
return
high
.
Count
+
regular
.
Count
==
1
;
}
}
internal
bool
Any
()
{
lock
(
regular
)
{
return
high
.
Count
!=
0
||
regular
.
Count
!=
0
;
}
}
internal
int
Count
()
{
lock
(
regular
)
{
return
high
.
Count
+
regular
.
Count
;
}
}
internal
Message
[]
DequeueAll
()
{
lock
(
regular
)
{
int
count
=
high
.
Count
+
regular
.
Count
;
if
(
count
==
0
)
return
Message
.
EmptyArray
;
var
arr
=
new
Message
[
count
];
high
.
CopyTo
(
arr
,
0
);
regular
.
CopyTo
(
arr
,
high
.
Count
);
high
.
Clear
();
regular
.
Clear
();
return
arr
;
}
}
internal
void
GetStormLog
(
StringBuilder
sb
)
{
lock
(
regular
)
{
int
total
=
0
;
if
(
high
.
Count
==
0
&&
regular
.
Count
==
0
)
return
;
sb
.
Append
(
"Unsent: "
).
Append
(
high
.
Count
+
regular
.
Count
).
AppendLine
();
foreach
(
var
item
in
high
)
{
if
(++
total
>=
500
)
break
;
item
.
AppendStormLog
(
sb
);
sb
.
AppendLine
();
}
foreach
(
var
item
in
regular
)
{
if
(++
total
>=
500
)
break
;
item
.
AppendStormLog
(
sb
);
sb
.
AppendLine
();
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment