diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/BaseCommand.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/BaseCommand.cs deleted file mode 100644 index a2c4e134..00000000 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/BaseCommand.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands -{ - public abstract class BaseCommand - { - protected readonly ScoreStatisticsQueueProcessor Queue = new ScoreStatisticsQueueProcessor(); - } -} diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Maintenance/DeleteNonPreservedScoresCommand.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Maintenance/DeleteNonPreservedScoresCommand.cs index 88e2a810..968ddf15 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Maintenance/DeleteNonPreservedScoresCommand.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Maintenance/DeleteNonPreservedScoresCommand.cs @@ -7,12 +7,13 @@ using Dapper; using McMaster.Extensions.CommandLineUtils; using MySqlConnector; +using osu.Server.QueueProcessor; using osu.Server.Queues.ScoreStatisticsProcessor.Models; namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands.Maintenance { [Command("cleanup", Description = "Delete non-preserved scores which are stale enough.")] - public class DeleteNonPreservedScoresCommand : BaseCommand + public class DeleteNonPreservedScoresCommand { /// /// How many hours non-preserved scores should be retained before being purged. @@ -21,8 +22,8 @@ public class DeleteNonPreservedScoresCommand : BaseCommand public async Task OnExecuteAsync(CancellationToken cancellationToken) { - using (var readConnection = Queue.GetDatabaseConnection()) - using (var deleteConnection = Queue.GetDatabaseConnection()) + using (var readConnection = DatabaseAccess.GetConnection()) + using (var deleteConnection = DatabaseAccess.GetConnection()) using (var deleteCommand = deleteConnection.CreateCommand()) { deleteCommand.CommandText = diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Maintenance/MarkNonPreservedScoresCommand.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Maintenance/MarkNonPreservedScoresCommand.cs index 56ab7f09..d138ac96 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Maintenance/MarkNonPreservedScoresCommand.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Maintenance/MarkNonPreservedScoresCommand.cs @@ -9,13 +9,14 @@ using Dapper; using McMaster.Extensions.CommandLineUtils; using MySqlConnector; +using osu.Server.QueueProcessor; using osu.Server.Queues.ScoreStatisticsProcessor.Helpers; using osu.Server.Queues.ScoreStatisticsProcessor.Models; namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands.Maintenance { [Command("mark-non-preserved", Description = "Mark any scores which no longer need to be preserved.")] - public class MarkNonPreservedScoresCommand : BaseCommand + public class MarkNonPreservedScoresCommand { private readonly ElasticQueueProcessor elasticQueueProcessor = new ElasticQueueProcessor(); @@ -28,7 +29,7 @@ public async Task OnExecuteAsync(CancellationToken cancellationToken) Console.WriteLine($"Running for ruleset {RulesetId}"); - using (var db = Queue.GetDatabaseConnection()) + using (var db = DatabaseAccess.GetConnection()) { Console.WriteLine("Fetching all users..."); int[] userIds = (await db.QueryAsync($"SELECT `user_id` FROM {databaseInfo.UserStatsTable}")).ToArray(); diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Maintenance/MigratePlaylistScoresToSoloScoresCommand.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Maintenance/MigratePlaylistScoresToSoloScoresCommand.cs index 7c435843..06b7d68e 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Maintenance/MigratePlaylistScoresToSoloScoresCommand.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Maintenance/MigratePlaylistScoresToSoloScoresCommand.cs @@ -17,12 +17,13 @@ using osu.Game.Rulesets; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; +using osu.Server.QueueProcessor; using osu.Server.Queues.ScoreStatisticsProcessor.Helpers; namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands.Maintenance { [Command("migrate-playlist-scores", Description = "Migrate scores from `multiplayer_scores` to `solo_scores`.")] - public class MigratePlaylistScoresToSoloScoresCommand : BaseCommand + public class MigratePlaylistScoresToSoloScoresCommand { /// /// The playlist room ID to reprocess. @@ -32,7 +33,7 @@ public class MigratePlaylistScoresToSoloScoresCommand : BaseCommand public async Task OnExecuteAsync(CancellationToken cancellationToken) { - using var db = Queue.GetDatabaseConnection(); + using var db = DatabaseAccess.GetConnection(); int[] playlistIds; diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Maintenance/RecalculatePlaylistTotalScoresCommand.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Maintenance/RecalculatePlaylistTotalScoresCommand.cs index f116ad3e..afb05191 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Maintenance/RecalculatePlaylistTotalScoresCommand.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Maintenance/RecalculatePlaylistTotalScoresCommand.cs @@ -16,13 +16,14 @@ using osu.Game.Rulesets; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; +using osu.Server.QueueProcessor; using osu.Server.Queues.ScoreStatisticsProcessor.Helpers; // ReSharper disable InconsistentNaming namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands.Maintenance { [Command("recalculate-playlist-scores", Description = "Process all scores in a specific playlist, recalculating and writing any changes.")] - public class RecalculatePlaylistTotalScoresCommand : BaseCommand + public class RecalculatePlaylistTotalScoresCommand { /// /// The playlist room ID to reprocess. @@ -35,7 +36,7 @@ public async Task OnExecuteAsync(CancellationToken cancellationToken) { foreach (string id in PlaylistIds.Split(',')) { - using (var db = Queue.GetDatabaseConnection()) + using (var db = DatabaseAccess.GetConnection()) { var playlistItems = await db.QueryAsync("SELECT * FROM multiplayer_playlist_items WHERE room_id = @PlaylistId", new { diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/PerformanceCommand.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/PerformanceCommand.cs index 1e7fa705..8ef34024 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/PerformanceCommand.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/PerformanceCommand.cs @@ -8,12 +8,13 @@ using System.Threading; using System.Threading.Tasks; using McMaster.Extensions.CommandLineUtils; +using osu.Server.QueueProcessor; using osu.Server.Queues.ScoreStatisticsProcessor.Helpers; using osu.Server.Queues.ScoreStatisticsProcessor.Processors; namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands.Performance { - public abstract class PerformanceCommand : BaseCommand + public abstract class PerformanceCommand { protected ScorePerformanceProcessor ScoreProcessor { get; private set; } = null!; protected UserTotalPerformanceProcessor TotalProcessor { get; private set; } = null!; @@ -61,7 +62,7 @@ protected async Task ProcessUserTotals(int[] userIds, CancellationToken cancella await ProcessPartitioned(userIds, async userId => { - using (var db = Queue.GetDatabaseConnection()) + using (var db = DatabaseAccess.GetConnection()) { var userStats = await DatabaseHelper.GetUserStatsAsync(userId, RulesetId, db); @@ -90,7 +91,7 @@ protected async Task ProcessUserScores(int[] userIds, CancellationToken cancella await ProcessPartitioned(userIds, async userId => { - using (var db = Queue.GetDatabaseConnection()) + using (var db = DatabaseAccess.GetConnection()) await ScoreProcessor.ProcessUserScoresAsync(userId, RulesetId, db); Console.WriteLine($"Processed {Interlocked.Increment(ref processedCount)} of {userIds.Length}"); }, cancellationToken); diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/Scores/UpdateAllScoresCommand.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/Scores/UpdateAllScoresCommand.cs index bf43421e..0a5c1294 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/Scores/UpdateAllScoresCommand.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/Scores/UpdateAllScoresCommand.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Dapper; using McMaster.Extensions.CommandLineUtils; +using osu.Server.QueueProcessor; using osu.Server.Queues.ScoreStatisticsProcessor.Helpers; namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands.Performance.Scores @@ -25,7 +26,7 @@ protected override async Task ExecuteAsync(CancellationToken cancellationTo long currentUserId; - using (var db = Queue.GetDatabaseConnection()) + using (var db = DatabaseAccess.GetConnection()) { if (Continue) currentUserId = await DatabaseHelper.GetCountAsync(databaseInfo.LastProcessedPpUserCount, db); @@ -38,7 +39,7 @@ protected override async Task ExecuteAsync(CancellationToken cancellationTo int? totalCount; - using (var db = Queue.GetDatabaseConnection()) + using (var db = DatabaseAccess.GetConnection()) { totalCount = await db.QuerySingleAsync($"SELECT COUNT(`user_id`) FROM {databaseInfo.UserStatsTable} WHERE `user_id` >= @UserId", new { @@ -57,7 +58,7 @@ protected override async Task ExecuteAsync(CancellationToken cancellationTo { int[] userIds; - using (var db = Queue.GetDatabaseConnection()) + using (var db = DatabaseAccess.GetConnection()) { userIds = (await db.QueryAsync($"SELECT `user_id` FROM {databaseInfo.UserStatsTable} WHERE `user_id` > @UserId ORDER BY `user_id` LIMIT @Limit", new { @@ -71,14 +72,14 @@ protected override async Task ExecuteAsync(CancellationToken cancellationTo await ProcessPartitioned(userIds, async userId => { - using (var db = Queue.GetDatabaseConnection()) + using (var db = DatabaseAccess.GetConnection()) await ScoreProcessor.ProcessUserScoresAsync(userId, RulesetId, db); Console.WriteLine($"Processed {Interlocked.Increment(ref processedCount)} of {totalCount}"); }, cancellationToken); currentUserId = userIds.Max(); - using (var db = Queue.GetDatabaseConnection()) + using (var db = DatabaseAccess.GetConnection()) await DatabaseHelper.SetCountAsync(databaseInfo.LastProcessedPpUserCount, currentUserId, db); } diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/Scores/UpdateScoresFromListCommand.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/Scores/UpdateScoresFromListCommand.cs index 275b0c23..87bf7a0d 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/Scores/UpdateScoresFromListCommand.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/Scores/UpdateScoresFromListCommand.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using JetBrains.Annotations; using McMaster.Extensions.CommandLineUtils; +using osu.Server.QueueProcessor; namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands.Performance.Scores { @@ -28,7 +29,7 @@ protected override async Task ExecuteAsync(CancellationToken cancellationTo await ProcessPartitioned(scoreIds, async id => { - using (var db = Queue.GetDatabaseConnection()) + using (var db = DatabaseAccess.GetConnection()) await ScoreProcessor.ProcessScoreAsync(id, db); Console.WriteLine($"Processed {Interlocked.Increment(ref processedCount)} of {scoreIds.Length}"); }, cancellationToken); diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/Scores/UpdateScoresFromSqlCommand.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/Scores/UpdateScoresFromSqlCommand.cs index 0ecc9a28..f3031edf 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/Scores/UpdateScoresFromSqlCommand.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/Scores/UpdateScoresFromSqlCommand.cs @@ -8,6 +8,7 @@ using Dapper; using JetBrains.Annotations; using McMaster.Extensions.CommandLineUtils; +using osu.Server.QueueProcessor; namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands.Performance.Scores { @@ -23,7 +24,7 @@ protected override async Task ExecuteAsync(CancellationToken cancellationTo { int[] userIds; - using (var db = Queue.GetDatabaseConnection()) + using (var db = DatabaseAccess.GetConnection()) userIds = (await db.QueryAsync(Statement)).ToArray(); await ProcessUserScores(userIds, cancellationToken); diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/UserTotals/UpdateAllUserTotalsCommand.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/UserTotals/UpdateAllUserTotalsCommand.cs index bc29e034..9baa4ee0 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/UserTotals/UpdateAllUserTotalsCommand.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Performance/UserTotals/UpdateAllUserTotalsCommand.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Dapper; using McMaster.Extensions.CommandLineUtils; +using osu.Server.QueueProcessor; using osu.Server.Queues.ScoreStatisticsProcessor.Helpers; namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands.Performance.UserTotals @@ -22,7 +23,7 @@ protected override async Task ExecuteAsync(CancellationToken cancellationTo Console.WriteLine("Fetching all users..."); - using (var db = Queue.GetDatabaseConnection()) + using (var db = DatabaseAccess.GetConnection()) userIds = (await db.QueryAsync($"SELECT `user_id` FROM {databaseInfo.UserStatsTable}")).ToArray(); Console.WriteLine($"Fetched {userIds.Length} users"); diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/ClearQueueCommand.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/ClearQueueCommand.cs index f221b813..8821cfe6 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/ClearQueueCommand.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/ClearQueueCommand.cs @@ -9,11 +9,13 @@ namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands.Queue { [Command("clear", Description = "Completely empties the processing queue")] - public class ClearQueueCommand : BaseCommand + public class ClearQueueCommand { + private readonly ScoreStatisticsQueueProcessor queue = new ScoreStatisticsQueueProcessor(); + public Task OnExecuteAsync(CancellationToken cancellationToken) { - Queue.ClearQueue(); + queue.ClearQueue(); Console.WriteLine("Queue has been cleared!"); return Task.FromResult(0); } diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/DeleteImportedHighScoresCommand.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/DeleteImportedHighScoresCommand.cs index 0d3707a1..125dbb50 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/DeleteImportedHighScoresCommand.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/DeleteImportedHighScoresCommand.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using Dapper; using McMaster.Extensions.CommandLineUtils; +using osu.Server.QueueProcessor; using osu.Server.Queues.ScoreStatisticsProcessor.Models; namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands.Queue @@ -31,7 +32,7 @@ namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands.Queue /// non-imported (lazer-first) scores anyway... /// [Command("delete-high-scores", Description = "Deletes already-imported high scores from the solo_scores table.")] - public class DeleteImportedHighScoresCommand : BaseCommand + public class DeleteImportedHighScoresCommand { /// /// The high score ID to start deleting imported high scores from. @@ -54,7 +55,7 @@ public async Task OnExecuteAsync(CancellationToken cancellationToken) Thread.Sleep(5000); - using (var conn = Queue.GetDatabaseConnection()) + using (var conn = DatabaseAccess.GetConnection()) { while (!cancellationToken.IsCancellationRequested) { diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/ImportHighScoresCommand.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/ImportHighScoresCommand.cs index 9f640bb8..cf5c1a87 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/ImportHighScoresCommand.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/ImportHighScoresCommand.cs @@ -24,6 +24,7 @@ using osu.Game.Rulesets.Scoring.Legacy; using osu.Game.Scoring; using osu.Game.Scoring.Legacy; +using osu.Server.QueueProcessor; using osu.Server.Queues.ScoreStatisticsProcessor.Helpers; using osu.Server.Queues.ScoreStatisticsProcessor.Models; @@ -38,7 +39,7 @@ namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands.Queue /// which can be used for tie-breaker scenarios. /// [Command("import-high-scores", Description = "Imports high scores from the osu_scores_high tables into the new solo_scores table.")] - public class ImportHighScoresCommand : BaseCommand + public class ImportHighScoresCommand { /// /// The ruleset to run this import job for. @@ -141,7 +142,7 @@ public async Task OnExecuteAsync(CancellationToken cancellationToken) lastId = StartId.Value; else { - using (var db = Queue.GetDatabaseConnection()) + using (var db = DatabaseAccess.GetConnection()) lastId = db.QuerySingleOrDefault($"SELECT MAX(old_score_id) FROM solo_scores_legacy_id_map WHERE ruleset_id = {RulesetId}") ?? 0; Console.WriteLine($"StartId not provided, using last legacy ID map entry ({lastId})"); @@ -159,7 +160,7 @@ public async Task OnExecuteAsync(CancellationToken cancellationToken) Thread.Sleep(5000); - using (var dbMainQuery = Queue.GetDatabaseConnection()) + using (var dbMainQuery = DatabaseAccess.GetConnection()) { while (!cancellationToken.IsCancellationRequested) { @@ -276,7 +277,7 @@ void queueNextBatch() if (batch.Count == 0) return; - runningBatches.Add(new BatchInserter(ruleset, () => Queue.GetDatabaseConnection(), batch.ToArray(), SkipExisting, SkipNew)); + runningBatches.Add(new BatchInserter(ruleset, batch.ToArray(), SkipExisting, SkipNew)); batch.Clear(); } } @@ -353,7 +354,6 @@ private void checkSlaveLatency(MySqlConnection db) private class BatchInserter { private readonly Ruleset ruleset; - private readonly Func getConnection; private readonly bool skipExisting; private readonly bool skipNew; @@ -363,10 +363,9 @@ private class BatchInserter public List IndexableSoloScoreIDs { get; } = new List(); - public BatchInserter(Ruleset ruleset, Func getConnection, HighScore[] scores, bool skipExisting, bool skipNew) + public BatchInserter(Ruleset ruleset, HighScore[] scores, bool skipExisting, bool skipNew) { this.ruleset = ruleset; - this.getConnection = getConnection; this.skipExisting = skipExisting; this.skipNew = skipNew; @@ -376,7 +375,7 @@ public BatchInserter(Ruleset ruleset, Func getConnection, HighS public async Task Run(HighScore[] scores) { - using (var db = getConnection()) + using (var db = DatabaseAccess.GetConnection()) using (var transaction = await db.BeginTransactionAsync()) using (var insertCommand = db.CreateCommand()) using (var updateCommand = db.CreateCommand()) diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/PumpAllScoresCommand.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/PumpAllScoresCommand.cs index e7cb7414..d5ce386f 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/PumpAllScoresCommand.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/PumpAllScoresCommand.cs @@ -6,12 +6,13 @@ using System.Threading.Tasks; using Dapper; using McMaster.Extensions.CommandLineUtils; +using osu.Server.QueueProcessor; using osu.Server.Queues.ScoreStatisticsProcessor.Models; namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands.Queue { [Command("pump-all", Description = "Pumps all existing `solo_scores` scores through the queue for reprocessing")] - public class PumpAllScoresCommand : BaseCommand + public class PumpAllScoresCommand { [Option("--start_id")] public long StartId { get; set; } @@ -22,10 +23,12 @@ public class PumpAllScoresCommand : BaseCommand [Option("--sql", Description = "Specify a custom query to limit the scope of pumping")] public string? CustomQuery { get; set; } + private readonly ScoreStatisticsQueueProcessor queue = new ScoreStatisticsQueueProcessor(); + public async Task OnExecuteAsync(CancellationToken cancellationToken) { - using (var dbMainQuery = Queue.GetDatabaseConnection()) - using (var db = Queue.GetDatabaseConnection()) + using (var dbMainQuery = DatabaseAccess.GetConnection()) + using (var db = DatabaseAccess.GetConnection()) { string query = "SELECT * FROM solo_scores WHERE id >= @StartId"; @@ -44,7 +47,7 @@ public async Task OnExecuteAsync(CancellationToken cancellationToken) var history = db.QuerySingleOrDefault("SELECT * FROM solo_scores_process_history WHERE score_id = @id", score); Console.WriteLine($"Pumping {score}"); - Queue.PushToQueue(new ScoreItem(score, history)); + queue.PushToQueue(new ScoreItem(score, history)); if (Delay > 0) await Task.Delay(Delay, cancellationToken); diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/PumpTestDataCommand.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/PumpTestDataCommand.cs index 0659fdeb..ec659b9d 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/PumpTestDataCommand.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/PumpTestDataCommand.cs @@ -10,8 +10,10 @@ namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands.Queue { [Command("pump-test", Description = "Pumps empty test scores to the queue")] - public class PumpTestDataCommand : BaseCommand + public class PumpTestDataCommand { + private readonly ScoreStatisticsQueueProcessor queue = new ScoreStatisticsQueueProcessor(); + public Task OnExecuteAsync(CancellationToken cancellationToken) { while (!cancellationToken.IsCancellationRequested) @@ -20,7 +22,7 @@ public Task OnExecuteAsync(CancellationToken cancellationToken) var scoreItem = new ScoreItem(new SoloScore()); Console.WriteLine($"Pumping {scoreItem}"); - Queue.PushToQueue(scoreItem); + queue.PushToQueue(scoreItem); Thread.Sleep(200); } diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/WatchQueueCommand.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/WatchQueueCommand.cs index f67f3838..5678a287 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/WatchQueueCommand.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/WatchQueueCommand.cs @@ -8,11 +8,13 @@ namespace osu.Server.Queues.ScoreStatisticsProcessor.Commands.Queue { [Command("watch", Description = "Begins processing of the queue.")] - public class WatchQueueCommand : BaseCommand + public class WatchQueueCommand { + private readonly ScoreStatisticsQueueProcessor queue = new ScoreStatisticsQueueProcessor(); + public Task OnExecuteAsync(CancellationToken cancellationToken) { - Queue.Run(cancellationToken); + queue.Run(cancellationToken); return Task.FromResult(0); } } diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/osu.Server.Queues.ScoreStatisticsProcessor.csproj b/osu.Server.Queues.ScoreStatisticsProcessor/osu.Server.Queues.ScoreStatisticsProcessor.csproj index 75e50ea1..8161da13 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/osu.Server.Queues.ScoreStatisticsProcessor.csproj +++ b/osu.Server.Queues.ScoreStatisticsProcessor/osu.Server.Queues.ScoreStatisticsProcessor.csproj @@ -17,7 +17,7 @@ - +