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
c4412192
Commit
c4412192
authored
Mar 21, 2017
by
dverma
Committed by
Nick Craver
Mar 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AbortOnConnectFailure message in unabletoconnect exception if AbortOnConnectFailure is set (#571)
parent
5b638256
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
8 deletions
+9
-8
ConnectionMultiplexer.cs
...change.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
+5
-5
ExceptionFactory.cs
StackExchange.Redis/StackExchange/Redis/ExceptionFactory.cs
+3
-2
PhysicalBridge.cs
StackExchange.Redis/StackExchange/Redis/PhysicalBridge.cs
+1
-1
No files found.
StackExchange.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
View file @
c4412192
...
@@ -794,7 +794,7 @@ public static async Task<ConnectionMultiplexer> ConnectAsync(string configuratio
...
@@ -794,7 +794,7 @@ public static async Task<ConnectionMultiplexer> ConnectAsync(string configuratio
bool
configured
=
await
muxer
.
ReconfigureAsync
(
true
,
false
,
log
,
null
,
"connect"
).
ObserveErrors
().
ForAwait
();
bool
configured
=
await
muxer
.
ReconfigureAsync
(
true
,
false
,
log
,
null
,
"connect"
).
ObserveErrors
().
ForAwait
();
if
(!
configured
)
if
(!
configured
)
{
{
throw
ExceptionFactory
.
UnableToConnect
(
muxer
.
failureMessage
);
throw
ExceptionFactory
.
UnableToConnect
(
muxer
.
RawConfig
.
AbortOnConnectFail
,
muxer
.
failureMessage
);
}
}
killMe
=
null
;
killMe
=
null
;
return
muxer
;
return
muxer
;
...
@@ -817,7 +817,7 @@ public static async Task<ConnectionMultiplexer> ConnectAsync(ConfigurationOption
...
@@ -817,7 +817,7 @@ public static async Task<ConnectionMultiplexer> ConnectAsync(ConfigurationOption
bool
configured
=
await
muxer
.
ReconfigureAsync
(
true
,
false
,
log
,
null
,
"connect"
).
ObserveErrors
().
ForAwait
();
bool
configured
=
await
muxer
.
ReconfigureAsync
(
true
,
false
,
log
,
null
,
"connect"
).
ObserveErrors
().
ForAwait
();
if
(!
configured
)
if
(!
configured
)
{
{
throw
ExceptionFactory
.
UnableToConnect
(
muxer
.
failureMessage
);
throw
ExceptionFactory
.
UnableToConnect
(
muxer
.
RawConfig
.
AbortOnConnectFail
,
muxer
.
failureMessage
);
}
}
killMe
=
null
;
killMe
=
null
;
return
muxer
;
return
muxer
;
...
@@ -876,14 +876,14 @@ private static ConnectionMultiplexer ConnectImpl(Func<ConnectionMultiplexer> mul
...
@@ -876,14 +876,14 @@ private static ConnectionMultiplexer ConnectImpl(Func<ConnectionMultiplexer> mul
task
.
ObserveErrors
();
task
.
ObserveErrors
();
if
(
muxer
.
RawConfig
.
AbortOnConnectFail
)
if
(
muxer
.
RawConfig
.
AbortOnConnectFail
)
{
{
throw
ExceptionFactory
.
UnableToConnect
(
"ConnectTimeout"
);
throw
ExceptionFactory
.
UnableToConnect
(
muxer
.
RawConfig
.
AbortOnConnectFail
,
"ConnectTimeout"
);
}
}
else
else
{
{
muxer
.
LastException
=
ExceptionFactory
.
UnableToConnect
(
"ConnectTimeout"
);
muxer
.
LastException
=
ExceptionFactory
.
UnableToConnect
(
muxer
.
RawConfig
.
AbortOnConnectFail
,
"ConnectTimeout"
);
}
}
}
}
if
(!
task
.
Result
)
throw
ExceptionFactory
.
UnableToConnect
(
muxer
.
failureMessage
);
if
(!
task
.
Result
)
throw
ExceptionFactory
.
UnableToConnect
(
muxer
.
RawConfig
.
AbortOnConnectFail
,
muxer
.
failureMessage
);
killMe
=
null
;
killMe
=
null
;
return
muxer
;
return
muxer
;
}
}
...
...
StackExchange.Redis/StackExchange/Redis/ExceptionFactory.cs
View file @
c4412192
...
@@ -194,10 +194,11 @@ static string GetLabel(bool includeDetail, RedisCommand command, Message message
...
@@ -194,10 +194,11 @@ static string GetLabel(bool includeDetail, RedisCommand command, Message message
return
message
==
null
?
command
.
ToString
()
:
(
includeDetail
?
message
.
CommandAndKey
:
message
.
Command
.
ToString
());
return
message
==
null
?
command
.
ToString
()
:
(
includeDetail
?
message
.
CommandAndKey
:
message
.
Command
.
ToString
());
}
}
internal
static
Exception
UnableToConnect
(
string
failureMessage
=
null
)
internal
static
Exception
UnableToConnect
(
bool
abortOnConnect
,
string
failureMessage
=
null
)
{
{
var
abortOnConnectionFailure
=
abortOnConnect
?
"to create a disconnected multiplexer, disable AbortOnConnectFail. "
:
""
;
return
new
RedisConnectionException
(
ConnectionFailureType
.
UnableToConnect
,
return
new
RedisConnectionException
(
ConnectionFailureType
.
UnableToConnect
,
"It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. "
+
failureMessage
);
string
.
Format
(
"It was not possible to connect to the redis server(s); {0}{1}"
,
abortOnConnectionFailure
,
failureMessage
)
);
}
}
internal
static
Exception
BeganProfilingWithDuplicateContext
(
object
forContext
)
internal
static
Exception
BeganProfilingWithDuplicateContext
(
object
forContext
)
...
...
StackExchange.Redis/StackExchange/Redis/PhysicalBridge.cs
View file @
c4412192
...
@@ -388,7 +388,7 @@ internal void OnHeartbeat(bool ifConnectedOnly)
...
@@ -388,7 +388,7 @@ internal void OnHeartbeat(bool ifConnectedOnly)
if
(
shouldRetry
)
if
(
shouldRetry
)
{
{
Interlocked
.
Increment
(
ref
connectTimeoutRetryCount
);
Interlocked
.
Increment
(
ref
connectTimeoutRetryCount
);
LastException
=
ExceptionFactory
.
UnableToConnect
(
"ConnectTimeout"
);
LastException
=
ExceptionFactory
.
UnableToConnect
(
Multiplexer
.
RawConfig
.
AbortOnConnectFail
,
"ConnectTimeout"
);
Trace
(
"Aborting connect"
);
Trace
(
"Aborting connect"
);
// abort and reconnect
// abort and reconnect
var
snapshot
=
physical
;
var
snapshot
=
physical
;
...
...
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