diff --git a/bootstrap/app.php b/bootstrap/app.php index 24fd4f41f..8f0f72133 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -166,7 +166,12 @@ return Application::configure(basePath: dirname(__DIR__)) $schedule->command('app:notification-epoch-update')->weeklyOn(1, '2:21')->onOneServer(); $schedule->command('app:hashtag-cached-count-update')->hourlyAt(25)->onOneServer(); $schedule->command('app:account-post-count-stat-update')->everySixHours(25)->onOneServer(); - $schedule->command('user:storage:recalculate --stale=168')->weeklyOn(3, '3:30')->onOneServer()->withoutOverlapping(1440); + if ((bool) config_cache('pixelfed.account_storage_reconcile')) { + // Optional drift reconciler. The upload/delete/read paths already + // self-heal stale storage_used counters, so this is disabled by + // default and only needed to tidy accounts that never upload/delete. + $schedule->command('user:storage:recalculate --stale=168')->weeklyOn(3, '3:30')->onOneServer()->withoutOverlapping(1440); + } $schedule->command('app:instance-update-total-local-posts')->twiceDailyAt(1, 13, 45)->onOneServer(); }) ->withExceptions(function (Exceptions $exceptions) { diff --git a/config/pixelfed.php b/config/pixelfed.php index 16ab0b3c2..9781babac 100644 --- a/config/pixelfed.php +++ b/config/pixelfed.php @@ -69,6 +69,19 @@ return [ */ 'max_account_size' => env('MAX_ACCOUNT_SIZE', 1000000), + /* + |-------------------------------------------------------------------------- + | Account storage reconciler + |-------------------------------------------------------------------------- + | + | Optional weekly scheduled task that recalculates users.storage_used from + | actual media, correcting drift on accounts that never upload or delete. + | The upload/delete/read paths already self-heal stale counters, so this is + | a background hygiene job and is disabled by default. + | + */ + 'account_storage_reconcile' => env('ACCOUNT_STORAGE_RECONCILE', false), + /* |-------------------------------------------------------------------------- | Photo file size limit