From 79014ec4b7c387b92b04affc25fa3a6c1c63fd6e Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sat, 19 Oct 2024 01:29:25 +0200 Subject: [PATCH] [backend/drive] Report count of orphaned files removed by storage cleanup job on completion --- Iceshrimp.Backend/Core/Services/StorageMaintenanceService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Iceshrimp.Backend/Core/Services/StorageMaintenanceService.cs b/Iceshrimp.Backend/Core/Services/StorageMaintenanceService.cs index d01a6d7b..69b14176 100644 --- a/Iceshrimp.Backend/Core/Services/StorageMaintenanceService.cs +++ b/Iceshrimp.Backend/Core/Services/StorageMaintenanceService.cs @@ -258,6 +258,7 @@ public class StorageMaintenanceService( .ToHashSet()); logger.LogInformation("Loaded {count} files from database.", filenames.Count); + var count = 0; if (options.Value.Local?.Path is { } path && Directory.Exists(path)) { @@ -271,6 +272,7 @@ public class StorageMaintenanceService( logger.LogInformation("Would delete {file} from disk, but --dry-run was specified.", file); else { + count++; try { File.Delete(file); @@ -295,6 +297,7 @@ public class StorageMaintenanceService( logger.LogInformation("Would delete {file} from object storage, but --dry-run was specified.", key); else { + count++; try { await objectStorageSvc.RemoveFilesAsync(key); @@ -307,6 +310,6 @@ public class StorageMaintenanceService( } } - logger.LogInformation("Finished scanning for orphaned files."); + logger.LogInformation("Finished removing {count} orphaned files.", count); } } \ No newline at end of file