Пример #1
0
        public static void VacuumAllDBs(ThreadControl tc)
        {
            tc.Log.AddLine("Starting Vacuuming all databases", Verbosity.Minimal);

            List <string> keys = DBMethods.GetConnectionKeys();

            long startSize = UC.GetFolderSize(Global.Constants.StockTicksDBPath);

            for (int m = 0; m < keys.Count; m += 60)
            {
                Parallel.For(0, 60, new ParallelOptions {
                    MaxDegreeOfParallelism = 20
                }, n =>
                {
                    if (m + n < keys.Count)
                    {
                        tc.Log.AddLine("Vacuuming " + keys[m + n], Verbosity.Verbose);
                        DBMethods.Vacuum(keys[m + n]);
                        tc.Log.AddLine("Done Vacuuming " + keys[m + n], Verbosity.Verbose);
                    }
                });
                if (!tc.CheckNotStopped())
                {
                    tc.Log.AddLine("Breaking VacuumAllDBs!");
                    break;
                }
            }

            Thread.Sleep(500);

            long endSize = UC.GetFolderSize(Global.Constants.StockTicksDBPath);

            tc.Log.AddLine("Vacuuming Complete. Start size: " + startSize + ", End size: " + endSize, Verbosity.Minimal);
        }