Skip to content

Commit

Permalink
v1.1.4 -debug: Connect timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Jun 30, 2023
1 parent 1b455b3 commit 1a7482f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/FreeRedis/FreeRedis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>FreeRedis</AssemblyName>
<PackageId>FreeRedis</PackageId>
<RootNamespace>FreeRedis</RootNamespace>
<Version>1.1.3</Version>
<Version>1.1.4</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageProjectUrl>https://github.com/2881099/FreeRedis</PackageProjectUrl>
<Description>FreeRedis is .NET redis client, supports cluster, sentinel, master-slave, pipeline, transaction and connection pool.</Description>
Expand Down
5 changes: 4 additions & 1 deletion src/FreeRedis/Internal/DefaultRedisSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,10 @@ public void Connect()
{
var endpointString = endpoint.ToString();
if (endpointString != $"{_ip}:{_port}") endpointString = $"{_ip}:{_port} -> {endpointString}";
throw new TimeoutException($"Connect to redis-server({endpointString}) timeout");
var debugString = "";
try { debugString = $", DEBUG: Dns.GetHostEntry({_ip})={Dns.GetHostEntry(_ip)}"; }
catch (Exception ex) { debugString = $", DEBUG: {ex.Message}"; }
throw new TimeoutException($"Connect to redis-server({endpointString}) timeout{debugString}");
}
localSocket.EndConnect(asyncResult);
_socket = localSocket;
Expand Down
4 changes: 2 additions & 2 deletions src/FreeRedis/Internal/ObjectPool/ObjectPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private void CheckAvailable(int interval)
{
conn.ResetValue();
}
if (Policy.OnCheckAvailable(conn) == false) throw new Exception("【{Policy.Name}】An exception needs to be thrown");
if (Policy.OnCheckAvailable(conn) == false) throw new Exception($"{Policy.Name}】An exception needs to be thrown");
break;
}
finally
Expand Down Expand Up @@ -373,7 +373,7 @@ async public Task<Object<T>> GetAsync()
if (obj == null)
{
if (Policy.AsyncGetCapacity > 0 && _getAsyncQueue.Count >= Policy.AsyncGetCapacity - 1)
throw new OutOfMemoryException($"{Policy.Name}】ObjectPool.GetAsync() The queue is too long. Policy. AsyncGetCapacity = {Policy.AsyncGetCapacity}");
throw new OutOfMemoryException($"{Policy.Name}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {Policy.AsyncGetCapacity}");

var tcs = new TaskCompletionSource<Object<T>>();

Expand Down

0 comments on commit 1a7482f

Please sign in to comment.