Skip to content

Commit

Permalink
Merge pull request #222 from smoogipoo/remove-docker-env-variable
Browse files Browse the repository at this point in the history
Remove `RUN_AS_SANDBOX_DOCKER` environment variable
  • Loading branch information
peppy committed Sep 4, 2023
2 parents 9ce8814 + 91ce127 commit 53a2820
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 47 deletions.
7 changes: 0 additions & 7 deletions osu.Server.DifficultyCalculator/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ public static class AppSettings
/// </summary>
public static readonly bool SAVE_DOWNLOADED;

/// <summary>
/// Whether the difficulty command should wait for docker to be ready and perform automatic operations.
/// </summary>
public static readonly bool RUN_AS_SANDBOX_DOCKER;

static AppSettings()
{
INSERT_BEATMAPS = Environment.GetEnvironmentVariable("INSERT_BEATMAPS") == "1";
Expand All @@ -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";
}
}
}
40 changes: 0 additions & 40 deletions osu.Server.DifficultyCalculator/Commands/CalculatorCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<int>("SELECT `count` FROM `osu_counts` WHERE `name` = 'docker_db_step'") >= 1)
initialised = true;
}

if (initialised)
break;
}
catch
{
}

Thread.Sleep(1000);
}
}

var beatmaps = new ConcurrentQueue<int>(GetBeatmaps());

totalBeatmaps = beatmaps.Count;
Expand Down Expand Up @@ -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.");
Expand Down

0 comments on commit 53a2820

Please sign in to comment.