Skip to content

Commit 9ec751a

Browse files
[release] 2.0.9 (#211)
* Update TimerServiceHost.cs * Also set the timestamp correctly --------- Co-authored-by: Sella-GH <147769367+Sella-GH@users.noreply.github.com>
1 parent bad1db2 commit 9ec751a

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.9 - 2024-11-03
2+
### Fixes
3+
- The bot now only checks each 12h if the discord permissions are set to prevent hitting discord ratelimits
4+
15
## 2.0.8 - 2024-10-27
26
### Dependencies
37
- Updated [Npgsql.EntityFrameworkCore.PostgreSQL](https://github.com/npgsql/efcore.pg) to version 8.0.10

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<PackageProjectUrl>https://github.com/Sella-GH/AzzyBot</PackageProjectUrl>
4242
<RepositoryType>Git</RepositoryType>
4343
<RepositoryUrl>https://github.com/Sella-GH/AzzyBot</RepositoryUrl>
44-
<Version>2.0.8</Version>
44+
<Version>2.0.9</Version>
4545
</PropertyGroup>
4646

4747
<!-- Package stuff -->

src/AzzyBot.Bot/Services/TimerServiceHost.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public sealed class TimerServiceHost(ILogger<TimerServiceHost> logger, AzzyBotSe
2727
private readonly Task _completedTask = Task.CompletedTask;
2828
private DateTime _lastAzzyBotUpdateCheck = DateTime.MinValue;
2929
private DateTime _lastCleanup = DateTime.MinValue;
30+
private DateTime _lastChannelPermissionCheck = DateTime.MinValue;
3031
private Timer? _timer;
3132
private bool _firstRun = true;
3233

@@ -75,19 +76,19 @@ private async void TimerTimeoutAsync(object? o)
7576
if (now - _lastAzzyBotUpdateCheck >= TimeSpan.FromHours(5.98))
7677
{
7778
_logger.GlobalTimerCheckForUpdates();
78-
_lastAzzyBotUpdateCheck = now;
79-
8079
await _updaterService.CheckForAzzyUpdatesAsync();
80+
_lastAzzyBotUpdateCheck = now;
8181
}
8282

8383
IAsyncEnumerable<GuildEntity> guilds = _dbActions.GetGuildsAsync(loadEverything: true);
8484
int guildCount = _discordBotService.GetDiscordGuilds.Count;
8585
int delay = 5 + guildCount;
8686

87-
if (!_firstRun)
87+
if (!_firstRun && now - _lastChannelPermissionCheck >= TimeSpan.FromHours(11.98))
8888
{
8989
_logger.GlobalTimerCheckForChannelPermissions(guildCount);
9090
await _discordBotService.CheckPermissionsAsync(guilds);
91+
_lastChannelPermissionCheck = now;
9192
}
9293

9394
await _azuraChecksBackgroundService.QueueInstancePingAsync(guilds, now);

0 commit comments

Comments
 (0)