From e0ca0ccb46c898af0dfce1d8f9a3935fef5fdfa0 Mon Sep 17 00:00:00 2001 From: 2881099 <2881099@qq.com> Date: Tue, 6 Sep 2022 20:45:18 +0800 Subject: [PATCH] v0.6.6 CheckAvailable retry --- src/FreeRedis/FreeRedis.csproj | 2 +- src/FreeRedis/Internal/ObjectPool/ObjectPool.cs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/FreeRedis/FreeRedis.csproj b/src/FreeRedis/FreeRedis.csproj index 9abc8768..a7dbdf8a 100644 --- a/src/FreeRedis/FreeRedis.csproj +++ b/src/FreeRedis/FreeRedis.csproj @@ -5,7 +5,7 @@ FreeRedis FreeRedis FreeRedis - 0.6.5 + 0.6.6 true https://github.com/2881099/FreeRedis FreeRedis is .NET redis client, supports cluster, sentinel, master-slave, pipeline, transaction and connection pool. diff --git a/src/FreeRedis/Internal/ObjectPool/ObjectPool.cs b/src/FreeRedis/Internal/ObjectPool/ObjectPool.cs index 97a02014..a5e7e02b 100644 --- a/src/FreeRedis/Internal/ObjectPool/ObjectPool.cs +++ b/src/FreeRedis/Internal/ObjectPool/ObjectPool.cs @@ -116,6 +116,15 @@ private void CheckAvailable(int interval) try { + try + { + Policy.OnCheckAvailable(conn); + break; + } + catch + { + conn.ResetValue(); + } if (Policy.OnCheckAvailable(conn) == false) throw new Exception("CheckAvailable 应抛出异常,代表仍然不可用。"); break; }