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
1bc10e16
Commit
1bc10e16
authored
Apr 01, 2019
by
mgravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
track the position in the queue that an item was *when added*
parent
a6c962ca
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
ExceptionFactory.cs
src/StackExchange.Redis/ExceptionFactory.cs
+1
-0
Message.cs
src/StackExchange.Redis/Message.cs
+2
-0
PhysicalBridge.cs
src/StackExchange.Redis/PhysicalBridge.cs
+5
-2
No files found.
src/StackExchange.Redis/ExceptionFactory.cs
View file @
1bc10e16
...
...
@@ -211,6 +211,7 @@ void add(string lk, string sk, string v)
add
(
"Timeout"
,
"timeout"
,
Format
.
ToString
(
mutiplexer
.
TimeoutMilliseconds
));
try
{
if
(
message
.
QueuePosition
>=
0
)
add
(
"QueuePosition"
,
null
,
message
.
QueuePosition
.
ToString
());
// the position the item was when added to the queue
if
(
message
.
TryGetPhysicalState
(
out
var
state
,
out
var
sentDelta
,
out
var
receivedDelta
))
{
add
(
"PhysicalState"
,
"phys"
,
state
.
ToString
());
...
...
src/StackExchange.Redis/Message.cs
View file @
1bc10e16
...
...
@@ -51,6 +51,7 @@ protected override void WriteImpl(PhysicalConnection physical)
internal
abstract
class
Message
:
ICompletable
{
public
readonly
int
Db
;
internal
int
QueuePosition
{
get
;
set
;
}
internal
const
CommandFlags
InternalCallFlag
=
(
CommandFlags
)
128
;
...
...
@@ -615,6 +616,7 @@ internal bool TrySetResult<T>(T value)
internal
void
SetEnqueued
(
PhysicalConnection
connection
)
{
QueuePosition
=
-
1
;
SetWriteTime
();
performance
?.
SetEnqueued
();
_enqueuedTo
=
connection
;
...
...
src/StackExchange.Redis/PhysicalBridge.cs
View file @
1bc10e16
...
...
@@ -137,11 +137,12 @@ private WriteResult QueueOrFailMessage(Message message)
{
// you can go in the queue, but we won't be starting
// a worker, because the handshake has not completed
message
.
SetEnqueued
(
null
);
lock
(
_backlog
)
{
message
.
QueuePosition
=
_backlog
.
Count
;
_backlog
.
Enqueue
(
message
);
}
message
.
SetEnqueued
(
null
);
return
WriteResult
.
Success
;
// we'll take it...
}
else
...
...
@@ -723,9 +724,11 @@ private bool PushToBacklog(Message message, bool onlyIfExists)
bool
wasEmpty
;
lock
(
_backlog
)
{
wasEmpty
=
_backlog
.
Count
==
0
;
int
count
=
_backlog
.
Count
;
wasEmpty
=
count
==
0
;
if
(
wasEmpty
&
onlyIfExists
)
return
false
;
message
.
QueuePosition
=
count
;
_backlog
.
Enqueue
(
message
);
}
if
(
wasEmpty
)
StartBacklogProcessor
();
...
...
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