From ba30fc8063b4c1e2b726a3d9b3ec795204e3009c Mon Sep 17 00:00:00 2001 From: Sellara <147769367+Sella-GH@users.noreply.github.com> Date: Thu, 7 Nov 2024 15:24:13 +0100 Subject: [PATCH] Update AzuraChecksBackgroundTask.cs Signed-off-by: Sellara <147769367+Sella-GH@users.noreply.github.com> --- .../BackgroundServices/AzuraChecksBackgroundTask.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/AzzyBot.Bot/Services/BackgroundServices/AzuraChecksBackgroundTask.cs b/src/AzzyBot.Bot/Services/BackgroundServices/AzuraChecksBackgroundTask.cs index f1624540..162f87a9 100644 --- a/src/AzzyBot.Bot/Services/BackgroundServices/AzuraChecksBackgroundTask.cs +++ b/src/AzzyBot.Bot/Services/BackgroundServices/AzuraChecksBackgroundTask.cs @@ -34,7 +34,7 @@ public async Task QueueApiPermissionChecksAsync(IAsyncEnumerable gu int counter = 0; await foreach (GuildEntity guild in guilds) { - if (guild.AzuraCast?.IsOnline is true && now > guild.AzuraCast.Checks.LastServerStatusCheck.AddMinutes(14.98)) + if (guild.AzuraCast?.IsOnline is true && now - guild.AzuraCast.Checks.LastServerStatusCheck > TimeSpan.FromHours(11.98)) { _ = Task.Run(async () => await _queue.QueueBackgroundWorkItemAsync(async ct => await _apiService.CheckForApiPermissionsAsync(guild.AzuraCast))); counter++; @@ -84,7 +84,7 @@ public async Task QueueFileChangesChecksAsync(IAsyncEnumerable guil int counter = 0; await foreach (GuildEntity guild in guilds.Where(g => g.AzuraCast?.IsOnline == true)) { - foreach (AzuraCastStationEntity station in guild.AzuraCast!.Stations.Where(s => s.Checks.FileChanges && now > s.Checks.LastFileChangesCheck.AddHours(0.98))) + foreach (AzuraCastStationEntity station in guild.AzuraCast!.Stations.Where(s => s.Checks.FileChanges && now - s.Checks.LastFileChangesCheck > TimeSpan.FromHours(0.98))) { _ = Task.Run(async () => await _queue.QueueBackgroundWorkItemAsync(async ct => await _fileService.CheckForFileChangesAsync(station, ct))); counter++; @@ -137,7 +137,7 @@ public async Task QueueInstancePingAsync(IAsyncEnumerable guilds, D int counter = 0; await foreach (GuildEntity guild in guilds) { - if (guild.AzuraCast?.Checks.ServerStatus is true && now > guild.AzuraCast?.Checks.LastServerStatusCheck.AddMinutes(14.98)) + if (guild.AzuraCast?.Checks.ServerStatus is true && now - guild.AzuraCast.Checks.LastServerStatusCheck > TimeSpan.FromMinutes(14.98)) { _ = Task.Run(async () => await _queue.QueueBackgroundWorkItemAsync(async ct => await _pingService.PingInstanceAsync(guild.AzuraCast, ct))); counter++; @@ -173,7 +173,7 @@ public async Task QueueUpdatesAsync(IAsyncEnumerable guilds, DateTi int counter = 0; await foreach (GuildEntity guild in guilds) { - if (guild.AzuraCast?.IsOnline is true && guild.AzuraCast.Checks.Updates && now > guild.AzuraCast.Checks.LastUpdateCheck.AddHours(11.98)) + if (guild.AzuraCast?.IsOnline is true && guild.AzuraCast.Checks.Updates && now - guild.AzuraCast.Checks.LastUpdateCheck > TimeSpan.FromHours(11.98)) { _ = Task.Run(async () => await _queue.QueueBackgroundWorkItemAsync(async ct => await _updaterService.CheckForAzuraCastUpdatesAsync(guild.AzuraCast!, ct))); counter++;