stabilizaiton work - projects rework for maintenanceability and ui livening
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Globalization;
|
||||
|
||||
namespace StellaOps.Provcache.Postgres;
|
||||
|
||||
public sealed partial class PostgresProvcacheRepository
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public async Task<long> DeleteByFeedEpochOlderThanAsync(string feedEpoch, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var deleted = await _context.ProvcacheItems
|
||||
.Where(e => string.Compare(e.FeedEpoch, feedEpoch) < 0)
|
||||
.ExecuteDeleteAsync(cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (deleted > 0)
|
||||
{
|
||||
await LogRevocationAsync("feed", feedEpoch, "feed-update", deleted, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return deleted;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<long> DeleteExpiredAsync(DateTimeOffset asOf, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var deleted = await _context.ProvcacheItems
|
||||
.Where(e => e.ExpiresAt <= asOf)
|
||||
.ExecuteDeleteAsync(cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (deleted > 0)
|
||||
{
|
||||
await LogRevocationAsync(
|
||||
"expired",
|
||||
asOf.ToString("O", CultureInfo.InvariantCulture),
|
||||
"ttl-expiry",
|
||||
deleted,
|
||||
cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return deleted;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user