[backend/startup] Add --recompute-counters argument

This commit is contained in:
Laura Hausmann 2024-02-22 01:41:11 +01:00
parent 27b3be774e
commit 9cd99eb244
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -86,6 +86,14 @@ public static class WebApplicationExtensions
Environment.Exit(1); Environment.Exit(1);
} }
if (args.Contains("--recompute-counters"))
{
app.Logger.LogInformation("Recomputing note & user counters, this will take a while...");
var maintenanceSvc = provider.GetRequiredService<DatabaseMaintenanceService>();
await maintenanceSvc.RecomputeNoteCountersAsync();
await maintenanceSvc.RecomputeUserCountersAsync();
}
app.Logger.LogInformation("Verifying redis connection..."); app.Logger.LogInformation("Verifying redis connection...");
var cache = provider.GetService<IDistributedCache>(); var cache = provider.GetService<IDistributedCache>();
if (cache == null) if (cache == null)