Notification service

This commit is contained in:
2025-04-27 23:44:03 +08:00
parent 3080e273cb
commit cb7179aa27
14 changed files with 2029 additions and 9 deletions

View File

@ -249,9 +249,12 @@ public class CloudFileUnusedRecyclingJob(AppDatabase db, FileService fs, ILogger
logger.LogInformation("Deleting unused cloud files...");
var cutoff = SystemClock.Instance.GetCurrentInstant() - Duration.FromHours(1);
var now = SystemClock.Instance.GetCurrentInstant();
var files = db.Files
.Where(f => f.UsedCount == 0)
.Where(f => f.CreatedAt < cutoff)
.Where(f =>
(f.ExpiredAt == null && f.UsedCount == 0 && f.CreatedAt < cutoff) ||
(f.ExpiredAt != null && f.ExpiredAt >= now)
)
.ToList();
logger.LogInformation($"Deleting {files.Count} unused cloud files...");