feat: use a FixedWindowRateLimiter keyed by IP to rate limit emails
we don't talk about the sent_emails table :)
This commit is contained in:
parent
1ce4f9d278
commit
51e335f090
8 changed files with 75 additions and 87 deletions
|
@ -33,9 +33,6 @@ public class DataCleanupService(
|
|||
|
||||
public async Task InvokeAsync(CancellationToken ct = default)
|
||||
{
|
||||
_logger.Debug("Cleaning up sent email cache");
|
||||
await CleanEmailsAsync(ct);
|
||||
|
||||
_logger.Debug("Cleaning up expired users");
|
||||
await CleanUsersAsync(ct);
|
||||
|
||||
|
@ -43,14 +40,6 @@ public class DataCleanupService(
|
|||
await CleanExportsAsync(ct);
|
||||
}
|
||||
|
||||
private async Task CleanEmailsAsync(CancellationToken ct = default)
|
||||
{
|
||||
Instant expiry = clock.GetCurrentInstant() - Duration.FromHours(2);
|
||||
int count = await db.SentEmails.Where(e => e.SentAt < expiry).ExecuteDeleteAsync(ct);
|
||||
if (count != 0)
|
||||
_logger.Information("Deleted {Count} entries from the sent email cache", expiry);
|
||||
}
|
||||
|
||||
private async Task CleanUsersAsync(CancellationToken ct = default)
|
||||
{
|
||||
Instant selfDeleteExpires = clock.GetCurrentInstant() - User.DeleteAfter;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue