- 优化 ObjectPool 恢复可用的时机;

This commit is contained in:
2881099
2023-09-07 11:27:05 +08:00
parent cac114ba04
commit 939bcb1005
2 changed files with 21 additions and 10 deletions

View File

@ -154,6 +154,8 @@ namespace FreeSql.Internal.ObjectPool
{
if (UnavailableException != null)
{
lock (_allObjectsLock)
_allObjects.ForEach(a => a.LastGetTime = a.LastReturnTime = new DateTime(2000, 1, 1));
UnavailableException = null;
UnavailableTime = null;
AvailableTime = DateTime.Now;
@ -164,9 +166,6 @@ namespace FreeSql.Internal.ObjectPool
if (isRestored)
{
lock (_allObjectsLock)
_allObjects.ForEach(a => a.LastGetTime = a.LastReturnTime = new DateTime(2000, 1, 1));
Policy.OnAvailable();
TestTrace.WriteLine($"【{Policy.Name}】Recovered", ConsoleColor.DarkGreen);
}