MySql.Data.MySqlClient.MySqlPoolManager.CleanIdleConnections C# (CSharp) Method

CleanIdleConnections() public static method

Remove drivers that have been idle for too long.
public static CleanIdleConnections ( object obj ) : void
obj object
return void
        public static void CleanIdleConnections(object obj)
        {
            List<Driver> oldDrivers = new List<Driver>();
            lock (pools.SyncRoot)
            {
                foreach (string key in pools.Keys)
                {
                    MySqlPool pool = (pools[key] as MySqlPool);
                    oldDrivers.AddRange(pool.RemoveOldIdleConnections());
                }
            }
            foreach(Driver driver in oldDrivers)
            {
                driver.Close();
            }
        }
    }