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
adee4c80
Commit
adee4c80
authored
Aug 06, 2018
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
track connection name in the connection fail/restore events
parent
776845f3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
11 deletions
+14
-11
ConnectionShutdown.cs
StackExchange.Redis.Tests/ConnectionShutdown.cs
+4
-4
ConnectionFailedEventArgs.cs
...ge.Redis/StackExchange/Redis/ConnectionFailedEventArgs.cs
+4
-1
ConnectionMultiplexer.cs
...change.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
+4
-4
PhysicalBridge.cs
StackExchange.Redis/StackExchange/Redis/PhysicalBridge.cs
+1
-1
ServerEndPoint.cs
StackExchange.Redis/StackExchange/Redis/ServerEndPoint.cs
+1
-1
No files found.
StackExchange.Redis.Tests/ConnectionShutdown.cs
View file @
adee4c80
...
...
@@ -9,9 +9,9 @@ namespace StackExchange.Redis.Tests
public
class
ConnectionShutdown
:
TestBase
{
protected
override
string
GetConfiguration
()
=>
TestConfig
.
Current
.
MasterServerAndPort
;
public
ConnectionShutdown
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
public
ConnectionShutdown
(
ITestOutputHelper
output
)
:
base
(
output
)
{
}
[
Fact
(
Skip
=
"Unfriendly"
)]
[
Fact
(
Skip
=
"Unfriendly"
)]
public
async
Task
ShutdownRaisesConnectionFailedAndRestore
()
{
using
(
var
conn
=
Create
(
allowAdmin
:
true
))
...
...
@@ -20,12 +20,12 @@ public async Task ShutdownRaisesConnectionFailedAndRestore()
Stopwatch
watch
=
Stopwatch
.
StartNew
();
conn
.
ConnectionFailed
+=
(
sender
,
args
)
=>
{
Log
(
watch
.
Elapsed
+
": failed: "
+
EndPointCollection
.
ToString
(
args
.
EndPoint
)
+
"/"
+
args
.
ConnectionType
);
Log
(
watch
.
Elapsed
+
": failed: "
+
EndPointCollection
.
ToString
(
args
.
EndPoint
)
+
"/"
+
args
.
ConnectionType
+
": "
+
args
.
ToString
()
);
Interlocked
.
Increment
(
ref
failed
);
};
conn
.
ConnectionRestored
+=
(
sender
,
args
)
=>
{
Log
(
watch
.
Elapsed
+
": restored: "
+
EndPointCollection
.
ToString
(
args
.
EndPoint
)
+
"/"
+
args
.
ConnectionType
);
Log
(
watch
.
Elapsed
+
": restored: "
+
EndPointCollection
.
ToString
(
args
.
EndPoint
)
+
"/"
+
args
.
ConnectionType
+
": "
+
args
.
ToString
()
);
Interlocked
.
Increment
(
ref
restored
);
};
var
db
=
conn
.
GetDatabase
();
...
...
StackExchange.Redis/StackExchange/Redis/ConnectionFailedEventArgs.cs
View file @
adee4c80
...
...
@@ -11,7 +11,7 @@ public sealed class ConnectionFailedEventArgs : EventArgs, ICompletable
{
private
readonly
EventHandler
<
ConnectionFailedEventArgs
>
handler
;
private
readonly
object
sender
;
internal
ConnectionFailedEventArgs
(
EventHandler
<
ConnectionFailedEventArgs
>
handler
,
object
sender
,
EndPoint
endPoint
,
ConnectionType
connectionType
,
ConnectionFailureType
failureType
,
Exception
exception
)
internal
ConnectionFailedEventArgs
(
EventHandler
<
ConnectionFailedEventArgs
>
handler
,
object
sender
,
EndPoint
endPoint
,
ConnectionType
connectionType
,
ConnectionFailureType
failureType
,
Exception
exception
,
string
physicalName
)
{
this
.
handler
=
handler
;
this
.
sender
=
sender
;
...
...
@@ -19,8 +19,11 @@ internal ConnectionFailedEventArgs(EventHandler<ConnectionFailedEventArgs> handl
ConnectionType
=
connectionType
;
Exception
=
exception
;
FailureType
=
failureType
;
_physicalName
=
physicalName
??
GetType
().
Name
;
}
private
readonly
string
_physicalName
;
/// <summary>
/// Gets the connection-type of the failing connection
/// </summary>
...
...
StackExchange.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
View file @
adee4c80
...
...
@@ -126,14 +126,14 @@ internal static string TryGetAzureRoleInstanceIdNoThrow()
/// </summary>
public
string
Configuration
=>
RawConfig
.
ToString
();
internal
void
OnConnectionFailed
(
EndPoint
endpoint
,
ConnectionType
connectionType
,
ConnectionFailureType
failureType
,
Exception
exception
,
bool
reconfigure
)
internal
void
OnConnectionFailed
(
EndPoint
endpoint
,
ConnectionType
connectionType
,
ConnectionFailureType
failureType
,
Exception
exception
,
bool
reconfigure
,
string
physicalName
)
{
if
(
_isDisposed
)
return
;
var
handler
=
ConnectionFailed
;
if
(
handler
!=
null
)
{
UnprocessableCompletionManager
.
CompleteSyncOrAsync
(
new
ConnectionFailedEventArgs
(
handler
,
this
,
endpoint
,
connectionType
,
failureType
,
exception
)
new
ConnectionFailedEventArgs
(
handler
,
this
,
endpoint
,
connectionType
,
failureType
,
exception
,
physicalName
)
);
}
if
(
reconfigure
)
...
...
@@ -161,14 +161,14 @@ internal void OnInternalError(Exception exception, EndPoint endpoint = null, Con
}
}
internal
void
OnConnectionRestored
(
EndPoint
endpoint
,
ConnectionType
connectionType
)
internal
void
OnConnectionRestored
(
EndPoint
endpoint
,
ConnectionType
connectionType
,
string
physicalName
)
{
if
(
_isDisposed
)
return
;
var
handler
=
ConnectionRestored
;
if
(
handler
!=
null
)
{
UnprocessableCompletionManager
.
CompleteSyncOrAsync
(
new
ConnectionFailedEventArgs
(
handler
,
this
,
endpoint
,
connectionType
,
ConnectionFailureType
.
None
,
null
)
new
ConnectionFailedEventArgs
(
handler
,
this
,
endpoint
,
connectionType
,
ConnectionFailureType
.
None
,
null
,
physicalName
)
);
}
ReconfigureIfNeeded
(
endpoint
,
false
,
"connection restored"
);
...
...
StackExchange.Redis/StackExchange/Redis/PhysicalBridge.cs
View file @
adee4c80
...
...
@@ -306,7 +306,7 @@ internal void OnConnectionFailed(PhysicalConnection connection, ConnectionFailur
LastException
=
innerException
;
reportNextFailure
=
false
;
// until it is restored
var
endpoint
=
ServerEndPoint
.
EndPoint
;
Multiplexer
.
OnConnectionFailed
(
endpoint
,
ConnectionType
,
failureType
,
innerException
,
reconfigureNextFailure
);
Multiplexer
.
OnConnectionFailed
(
endpoint
,
ConnectionType
,
failureType
,
innerException
,
reconfigureNextFailure
,
connection
?.
ToString
()
);
}
}
...
...
StackExchange.Redis/StackExchange/Redis/ServerEndPoint.cs
View file @
adee4c80
...
...
@@ -491,7 +491,7 @@ internal void OnFullyEstablished(PhysicalConnection connection)
{
Multiplexer
.
ResendSubscriptions
(
this
);
}
Multiplexer
.
OnConnectionRestored
(
EndPoint
,
bridge
.
ConnectionType
);
Multiplexer
.
OnConnectionRestored
(
EndPoint
,
bridge
.
ConnectionType
,
connection
?.
ToString
()
);
}
}
catch
(
Exception
ex
)
...
...
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