mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 12:28:15 +08:00
优化 连接池对象预热效率,开启每10个线程进行预热;
This commit is contained in:
@ -80,16 +80,7 @@ namespace FreeSql.Sqlite {
|
||||
Attaches = (idx == -1 ? att[1] : att[1].Substring(0, idx)).Split(',');
|
||||
}
|
||||
|
||||
var initConns = new List<Object<DbConnection>>();
|
||||
for (var a = 0; a < PoolSize; a++)
|
||||
try {
|
||||
var conn = _pool.Get();
|
||||
initConns.Add(conn);
|
||||
conn.Value.Ping(true);
|
||||
} catch {
|
||||
break; //预热失败一次就退出
|
||||
}
|
||||
foreach (var conn in initConns) _pool.Return(conn);
|
||||
FreeUtil.PrevReheatConnectionPool(_pool);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user