public static async Task Shutdown(bool isRestart = false) { try { await LogHelper.LogInfo(isRestart? "Bot restart requested..." : $"Bot shutdown requested..."); APIHelper.StopServices(); IsClosing = true; while (!_canClose || !TickManager.AllModulesReadyToClose()) { await Task.Delay(10); } await LogHelper.LogInfo(isRestart? "Bot is ready for restart" : "Bot shutdown complete"); } catch { // ignore } return; }
internal static async Task Shutdown(bool isRestart = false) { try { await LogHelper.LogInfo(isRestart? "Server restart requested..." : $"Server shutdown requested..."); APIHelper.StopServices(); IsClosing = true; while (!_canClose || !TickManager.AllModulesReadyToClose()) { await Task.Delay(10); } await LogHelper.LogInfo(isRestart? "Server is ready for restart" : "Server shutdown complete"); Environment.Exit(isRestart ? 1001 : 1002); } finally { _confirmClose = true; } return; }