[backend/core] Make MediaCleanupTask print a log message on success
This commit is contained in:
parent
6379a09c12
commit
3d4cacb6d6
1 changed files with 4 additions and 1 deletions
|
@ -30,8 +30,9 @@ public class MediaCleanupTask : ICronTask
|
||||||
if (!config.CleanBanners) query = query.Where(p => !db.Users.Any(u => u.BannerId == p.Id));
|
if (!config.CleanBanners) query = query.Where(p => !db.Users.Any(u => u.BannerId == p.Id));
|
||||||
|
|
||||||
var fileIds = query.Select(p => p.Id);
|
var fileIds = query.Select(p => p.Id);
|
||||||
|
var cnt = await fileIds.CountAsync();
|
||||||
|
|
||||||
logger.LogInformation("Expiring {count} files...", await fileIds.CountAsync());
|
logger.LogInformation("Expiring {count} files...", cnt);
|
||||||
await foreach (var fileId in fileIds.AsAsyncEnumerable())
|
await foreach (var fileId in fileIds.AsAsyncEnumerable())
|
||||||
{
|
{
|
||||||
await queueService.BackgroundTaskQueue.EnqueueAsync(new DriveFileDeleteJobData
|
await queueService.BackgroundTaskQueue.EnqueueAsync(new DriveFileDeleteJobData
|
||||||
|
@ -39,6 +40,8 @@ public class MediaCleanupTask : ICronTask
|
||||||
DriveFileId = fileId, Expire = true
|
DriveFileId = fileId, Expire = true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.LogInformation("Successfully cleaned up {count} expired media files.", cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Midnight
|
// Midnight
|
||||||
|
|
Loading…
Add table
Reference in a new issue