mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 14:10:53 +00:00
Don't bother with nice shutdown, closes #94
We really don't need any of that when we're exiting process anyway, framework does that better
This commit is contained in:
@@ -114,14 +114,6 @@ namespace ArchiSteamFarm {
|
||||
return Bots.Count;
|
||||
}
|
||||
|
||||
internal static async Task ShutdownAllBots() {
|
||||
List<Task> tasks = new List<Task>();
|
||||
foreach (Bot bot in Bots.Values) {
|
||||
tasks.Add(Task.Run(async () => await bot.Shutdown().ConfigureAwait(false)));
|
||||
}
|
||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
internal static void RefreshCMs() {
|
||||
bool initialized = false;
|
||||
while (!initialized) {
|
||||
@@ -832,10 +824,10 @@ namespace ArchiSteamFarm {
|
||||
case "!2faoff":
|
||||
return Response2FAOff(BotName);
|
||||
case "!exit":
|
||||
await ShutdownAllBots().ConfigureAwait(false);
|
||||
Program.Exit();
|
||||
return "Done";
|
||||
case "!restart":
|
||||
await Program.Restart().ConfigureAwait(false);
|
||||
Program.Restart();
|
||||
return "Done";
|
||||
case "!status":
|
||||
return ResponseStatus();
|
||||
|
||||
@@ -93,15 +93,13 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
internal static async Task Exit(int exitCode = 0) {
|
||||
await Bot.ShutdownAllBots().ConfigureAwait(false);
|
||||
internal static void Exit(int exitCode = 0) {
|
||||
Environment.Exit(exitCode);
|
||||
}
|
||||
|
||||
internal static async Task Restart() {
|
||||
await Bot.ShutdownAllBots().ConfigureAwait(false);
|
||||
internal static void Restart() {
|
||||
System.Diagnostics.Process.Start(ExecutableFile, string.Join(" ", Environment.GetCommandLineArgs()));
|
||||
Environment.Exit(0);
|
||||
Exit();
|
||||
}
|
||||
|
||||
internal static async Task LimitSteamRequestsAsync() {
|
||||
@@ -259,7 +257,7 @@ namespace ArchiSteamFarm {
|
||||
if (!Directory.Exists(ConfigDirectory)) {
|
||||
Logging.LogGenericError("Config directory doesn't exist!");
|
||||
Thread.Sleep(5000);
|
||||
Task.Run(async () => await Exit(1).ConfigureAwait(false)).Wait();
|
||||
Exit(1);
|
||||
}
|
||||
|
||||
// Before attempting to connect, initialize our list of CMs
|
||||
|
||||
Reference in New Issue
Block a user