mirror of
https://github.com/NoiTheCat/BirthdayBot.git
synced 2024-11-21 13:54:36 +00:00
Merge pull request #55 from NoiTheCat/fixes/retention-errors
Fix data retention bugs causing mass deletion of birthdays
This commit is contained in:
commit
df09e4ab18
2 changed files with 3 additions and 1 deletions
|
@ -53,9 +53,11 @@ class DataRetention : BackgroundService {
|
|||
|
||||
// And let go of old data
|
||||
var staleGuildCount = await db.GuildConfigurations
|
||||
.Where(g => localGuilds.Contains(g.GuildId))
|
||||
.Where(g => now - TimeSpan.FromDays(StaleGuildThreshold) > g.LastSeen)
|
||||
.ExecuteDeleteAsync();
|
||||
var staleUserCount = await db.UserEntries
|
||||
.Where(gu => localGuilds.Contains(gu.GuildId))
|
||||
.Where(gu => now - TimeSpan.FromDays(StaleUserThreashold) > gu.LastSeen)
|
||||
.ExecuteDeleteAsync();
|
||||
|
||||
|
|
|
@ -57,11 +57,11 @@ class ShardBackgroundWorker : IDisposable {
|
|||
if (Instance.DiscordClient.ConnectionState != ConnectionState.Connected) continue;
|
||||
|
||||
// Execute tasks sequentially
|
||||
_tickCount++;
|
||||
foreach (var service in _workers) {
|
||||
CurrentExecutingService = service.GetType().Name;
|
||||
try {
|
||||
if (_workerCanceller.IsCancellationRequested) break;
|
||||
_tickCount++;
|
||||
await service.OnTick(_tickCount, _workerCanceller.Token);
|
||||
} catch (Exception ex) when (ex is not
|
||||
(TaskCanceledException or OperationCanceledException or ObjectDisposedException)) {
|
||||
|
|
Loading…
Reference in a new issue