From 9cd99eb2445e90b764613a65f5407ae2f3082fa4 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Thu, 22 Feb 2024 01:41:11 +0100 Subject: [PATCH] [backend/startup] Add --recompute-counters argument --- .../Core/Extensions/WebApplicationExtensions.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Iceshrimp.Backend/Core/Extensions/WebApplicationExtensions.cs b/Iceshrimp.Backend/Core/Extensions/WebApplicationExtensions.cs index 85004fde..38cb0b03 100644 --- a/Iceshrimp.Backend/Core/Extensions/WebApplicationExtensions.cs +++ b/Iceshrimp.Backend/Core/Extensions/WebApplicationExtensions.cs @@ -86,6 +86,14 @@ public static class WebApplicationExtensions Environment.Exit(1); } + if (args.Contains("--recompute-counters")) + { + app.Logger.LogInformation("Recomputing note & user counters, this will take a while..."); + var maintenanceSvc = provider.GetRequiredService(); + await maintenanceSvc.RecomputeNoteCountersAsync(); + await maintenanceSvc.RecomputeUserCountersAsync(); + } + app.Logger.LogInformation("Verifying redis connection..."); var cache = provider.GetService(); if (cache == null)