Skip to content

Commit

Permalink
Remove package update check
Browse files Browse the repository at this point in the history
  • Loading branch information
FloatingMilkshake committed Feb 21, 2025
1 parent 46f53c2 commit c4944cd
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 151 deletions.
22 changes: 2 additions & 20 deletions Commands/Owner/HomeServerCommands/DebugCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,13 @@ public static async Task DebugChecks(MechanicalMilkshake.SlashCommandContext ctx
int numRemindersSent = default;
int numRemindersFailed = default;
int numRemindersWithNullTime = default;
int numHostsChecked = default;
int totalNumHosts = default;
string checkResult = default;
double dbPing = default;

switch (checksToRun)
{
case "all":
(numRemindersBefore, numRemindersAfter, numRemindersSent, numRemindersFailed, numRemindersWithNullTime) =
await ReminderTasks.CheckRemindersAsync();
(numHostsChecked, totalNumHosts, checkResult) = await PackageUpdateTasks.CheckPackageUpdatesAsync();
dbPing = await DatabaseTasks.CheckDatabaseConnectionAsync();
break;
case "reminders":
Expand All @@ -168,9 +164,6 @@ public static async Task DebugChecks(MechanicalMilkshake.SlashCommandContext ctx
case "databaseConnection":
dbPing = await DatabaseTasks.CheckDatabaseConnectionAsync();
break;
case "packageUpdates":
(numHostsChecked, totalNumHosts, checkResult) = await PackageUpdateTasks.CheckPackageUpdatesAsync();
break;
}

// templates for check result messages
Expand All @@ -186,30 +179,20 @@ public static async Task DebugChecks(MechanicalMilkshake.SlashCommandContext ctx
// database ping
var dbPingResultMessage = $"**Database ping:** {(double.IsNaN(dbPing) ? "Unreachable!" : $"`{dbPing}ms`")}";

// package updates
var packageUpdateCheckResultMessage = "**Package Updates:** " + (totalNumHosts == 0
? "No hosts to check for package updates.\n"
: $"Checked `{numHostsChecked}`/`{totalNumHosts}` hosts for package updates.\n> ");
if (numHostsChecked != 0 && checkResult is not null)
packageUpdateCheckResultMessage += $"{checkResult.Replace("\n", "\n> ")}";

// set up response msg content
// include relevant check results (see variables)
var response = "Done!\n";
switch (checksToRun)
{
case "all":
response += $"{reminderCheckResultMessage}\n{dbPingResultMessage}\n{packageUpdateCheckResultMessage}";
response += $"{reminderCheckResultMessage}\n{dbPingResultMessage}";
break;
case "reminders":
response += reminderCheckResultMessage;
break;
case "databaseConnection":
response += dbPingResultMessage;
break;
case "packageUpdates":
response += packageUpdateCheckResultMessage;
break;
}

// send response
Expand Down Expand Up @@ -271,8 +254,7 @@ private class ChecksChoiceProvider : IChoiceProvider
[
new("All", "all"),
new("Reminders", "reminders"),
new("Database Connection", "databaseConnection"),
new("Package Updates", "packageUpdates")
new("Database Connection", "databaseConnection")
];

public async ValueTask<IEnumerable<DiscordApplicationCommandOptionChoice>> ProvideAsync(CommandParameter parameter) => Choices;
Expand Down
4 changes: 0 additions & 4 deletions ConfigJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ public class BaseConfig

[JsonProperty("authorizedUsers")] public string[] AuthorizedUsers { get; private set; }

[JsonProperty("sshHosts")] public string[] SshHosts { get; private set; }

[JsonProperty("packageUpdateCheckIntervalDays")] public int PackageUpdateCheckIntervalDays { get; private set; }

[JsonProperty("useServerSpecificFeatures")] public bool UseServerSpecificFeatures { get; private set; }

[JsonProperty("uptimeKumaHeartbeatUrl")] public string UptimeKumaHeartbeatUrl { get; private set; }
Expand Down
3 changes: 0 additions & 3 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,6 @@ internal static async Task Main()
// Populate ApplicationCommands
await Task.Run(async () => CommandTasks.ExecuteAsync());

// Package update check
await Task.Run(async () => PackageUpdateTasks.ExecuteAsync());

// Reminder check
await Task.Run(async () => ReminderTasks.ExecuteAsync());

Expand Down
119 changes: 0 additions & 119 deletions Tasks/PackageUpdateTasks.cs

This file was deleted.

5 changes: 0 additions & 5 deletions config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
"",
""
],
"sshHosts": [
"",
""
],
"packageUpdateCheckIntervalDays": 0,
"useServerSpecificFeatures": false,
"uptimeKumaHeartbeatUrl": ""
},
Expand Down

0 comments on commit c4944cd

Please sign in to comment.