Example #1
0
        private async Task PerformStatsGcAsync()
        {
            logger.Info(() => $"Performing stats DB cleanup");

            await cf.Run(async con =>
            {
                // MinerNL Stats cleanup
                var _StatsDBCleanupHistory = clusterConfig.Statistics?.StatsDBCleanupHistory ?? statsDBCleanupHistory;
                if (_StatsDBCleanupHistory == 0)
                {
                    _StatsDBCleanupHistory = statsDBCleanupHistory;
                    logger.Info(() => $"statistics -> statsDBCleanupHistory not found in config.json. using default : {statsDBCleanupHistory} days");
                }

                logger.Info(() => $"Removing all stats older then {_StatsDBCleanupHistory} days");

                var cutOff = DateTime.UtcNow.AddDays(-_StatsDBCleanupHistory);
                // MinerNL end

                var rowCount = await statsRepo.DeletePoolStatsBeforeAsync(con, cutOff);
                if (rowCount > 0)
                {
                    logger.Info(() => $"Deleted {rowCount} old poolstats records");
                }

                rowCount = await statsRepo.DeleteMinerStatsBeforeAsync(con, cutOff);
                if (rowCount > 0)
                {
                    logger.Info(() => $"Deleted {rowCount} old minerstats records");
                }
            });

            logger.Info(() => $"Stats cleanup DB complete");
        }
Example #2
0
        private async Task PerformStatsGcAsync()
        {
            logger.Info(() => $"Performing Stats GC");

            await cf.Run(async con =>
            {
                var cutOff = DateTime.UtcNow.AddMonths(-3);

                var rowCount = await statsRepo.DeletePoolStatsBeforeAsync(con, cutOff);
                if (rowCount > 0)
                {
                    logger.Info(() => $"Deleted {rowCount} old poolstats records");
                }

                rowCount = await statsRepo.DeleteMinerStatsBeforeAsync(con, cutOff);
                if (rowCount > 0)
                {
                    logger.Info(() => $"Deleted {rowCount} old minerstats records");
                }
            });

            logger.Info(() => $"Stats GC complete");
        }