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
c4e368f6
Commit
c4e368f6
authored
May 26, 2015
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More ManagerState states; track last error relative time
parent
a4e9a582
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
2 deletions
+21
-2
ConnectionMultiplexer.cs
...change.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
+3
-0
PhysicalConnection.cs
...kExchange.Redis/StackExchange/Redis/PhysicalConnection.cs
+3
-1
SocketManager.Poll.cs
...kExchange.Redis/StackExchange/Redis/SocketManager.Poll.cs
+15
-1
No files found.
StackExchange.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
View file @
c4e368f6
...
...
@@ -1876,6 +1876,8 @@ internal T ExecuteSyncImpl<T>(Message message, ResultProcessor<T> processor, Ser
string
iocp
,
worker
;
#if !__MonoCS__
var
mgrState
=
socketManager
.
State
;
var
lastError
=
socketManager
.
LastErrorTimeRelative
();
#endif
var
sb
=
new
StringBuilder
(
"Timeout performing "
).
Append
(
message
.
CommandAndKey
);
data
=
new
List
<
Tuple
<
string
,
string
>>
{
Tuple
.
Create
(
"Message"
,
message
.
CommandAndKey
)};
...
...
@@ -1890,6 +1892,7 @@ internal T ExecuteSyncImpl<T>(Message message, ResultProcessor<T> processor, Ser
add
(
"Instantaneous"
,
"inst"
,
inst
.
ToString
());
#if !__MonoCS__
add
(
"Manager-State"
,
"mgr"
,
mgrState
.
ToString
());
add
(
"Last-Error"
,
"err"
,
lastError
);
#endif
add
(
"Queue-Length"
,
"queue"
,
queue
.
ToString
());
add
(
"Queue-Outstanding"
,
"qu"
,
qu
.
ToString
());
...
...
StackExchange.Redis/StackExchange/Redis/PhysicalConnection.cs
View file @
c4e368f6
...
...
@@ -218,7 +218,9 @@ public void RecordConnectionFailed(ConnectionFailureType failureType, Exception
add
(
"Last-Multiplexer-Heartbeat"
,
"last-mbeat"
,
multiplexer
.
LastHeartbeatSecondsAgo
+
"s ago"
);
add
(
"Last-Global-Heartbeat"
,
"global"
,
ConnectionMultiplexer
.
LastGlobalHeartbeatSecondsAgo
+
"s ago"
);
#if !__MonoCS__
add
(
"SocketManager-State"
,
"mgr"
,
bridge
.
Multiplexer
.
SocketManager
.
State
.
ToString
());
var
mgr
=
bridge
.
Multiplexer
.
SocketManager
;
add
(
"SocketManager-State"
,
"mgr"
,
mgr
.
State
.
ToString
());
add
(
"Last-Error"
,
"err"
,
mgr
.
LastErrorTimeRelative
());
#endif
var
ex
=
innerException
==
null
...
...
StackExchange.Redis/StackExchange/Redis/SocketManager.Poll.cs
View file @
c4e368f6
...
...
@@ -162,6 +162,8 @@ internal enum ManagerState
GrowingSocketArray
,
CopyingPointersForSelect
,
ExecuteSelect
,
ExecuteSelectComplete
,
CheckForStaleConnections
,
EnqueueRead
,
EnqueueError
,
RequestAssistance
,
...
...
@@ -174,7 +176,13 @@ internal ManagerState State
get
{
return
managerState
;
}
}
private
volatile
ManagerState
managerState
;
private
volatile
int
lastErrorTicks
;
internal
string
LastErrorTimeRelative
()
{
var
tmp
=
lastErrorTicks
;
if
(
tmp
==
0
)
return
"never"
;
return
unchecked
(
Environment
.
TickCount
-
tmp
)
+
"ms ago"
;
}
private
void
ReadImpl
()
{
List
<
IntPtr
>
dead
=
null
,
active
=
new
List
<
IntPtr
>();
...
...
@@ -268,15 +276,21 @@ private void ReadImpl()
var
timeout
=
new
TimeValue
(
1000
);
managerState
=
ManagerState
.
ExecuteSelect
;
ready
=
select
(
0
,
readSockets
,
null
,
errorSockets
,
ref
timeout
);
managerState
=
ManagerState
.
ExecuteSelectComplete
;
if
(
ready
<=
0
)
{
if
(
ready
==
0
)
{
managerState
=
ManagerState
.
CheckForStaleConnections
;
foreach
(
var
s
in
activeCallbacks
)
{
s
.
CheckForStaleConnection
();
}
}
else
{
lastErrorTicks
=
Environment
.
TickCount
;
}
continue
;
// -ve typically means a socket was disposed just before; just retry
}
...
...
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