From 91ce12749e2f41ffc03185917b0121218329950a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 4 Sep 2023 17:59:34 +0900 Subject: [PATCH] Remove RUN_AS_SANDBOX_DOCKER environment variable --- .../AppSettings.cs | 7 ---- .../Commands/CalculatorCommand.cs | 40 ------------------- 2 files changed, 47 deletions(-) diff --git a/osu.Server.DifficultyCalculator/AppSettings.cs b/osu.Server.DifficultyCalculator/AppSettings.cs index 96bc9b8..759dbb6 100644 --- a/osu.Server.DifficultyCalculator/AppSettings.cs +++ b/osu.Server.DifficultyCalculator/AppSettings.cs @@ -38,11 +38,6 @@ public static class AppSettings /// public static readonly bool SAVE_DOWNLOADED; - /// - /// Whether the difficulty command should wait for docker to be ready and perform automatic operations. - /// - public static readonly bool RUN_AS_SANDBOX_DOCKER; - static AppSettings() { INSERT_BEATMAPS = Environment.GetEnvironmentVariable("INSERT_BEATMAPS") == "1"; @@ -52,8 +47,6 @@ static AppSettings() BEATMAPS_PATH = Environment.GetEnvironmentVariable("BEATMAPS_PATH") ?? "osu"; DOWNLOAD_PATH = Environment.GetEnvironmentVariable("DOWNLOAD_PATH") ?? "https://osu.ppy.sh/osu/{0}"; - - RUN_AS_SANDBOX_DOCKER = Environment.GetEnvironmentVariable("DOCKER") == "1"; } } } diff --git a/osu.Server.DifficultyCalculator/Commands/CalculatorCommand.cs b/osu.Server.DifficultyCalculator/Commands/CalculatorCommand.cs index d7ccd8f..d36a5e9 100644 --- a/osu.Server.DifficultyCalculator/Commands/CalculatorCommand.cs +++ b/osu.Server.DifficultyCalculator/Commands/CalculatorCommand.cs @@ -7,7 +7,6 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Dapper; using McMaster.Extensions.CommandLineUtils; namespace osu.Server.DifficultyCalculator.Commands @@ -64,33 +63,6 @@ public void OnExecute(CommandLineApplication app, IConsole console) threadBeatmapIds = new int[Concurrency]; - if (AppSettings.RUN_AS_SANDBOX_DOCKER) - { - reporter.Output("Waiting for database..."); - - while (true) - { - try - { - bool initialised = false; - - using (var conn = Database.GetConnection()) - { - if (conn.QuerySingle("SELECT `count` FROM `osu_counts` WHERE `name` = 'docker_db_step'") >= 1) - initialised = true; - } - - if (initialised) - break; - } - catch - { - } - - Thread.Sleep(1000); - } - } - var beatmaps = new ConcurrentQueue(GetBeatmaps()); totalBeatmaps = beatmaps.Count; @@ -136,18 +108,6 @@ public void OnExecute(CommandLineApplication app, IConsole console) using (new Timer(_ => outputHealth(), null, 5000, 5000)) Task.WaitAll(tasks); - if (AppSettings.RUN_AS_SANDBOX_DOCKER) - { - using (var conn = Database.GetConnection()) - { - conn.Execute("INSERT INTO `osu_counts` (`name`, `count`) VALUES (@Name, @Count) ON DUPLICATE KEY UPDATE `count` = @Count", new - { - Name = "docker_db_step", - Count = 2 - }); - } - } - outputProgress(); reporter.Output("Done.");