diff --git a/app/Console/Commands/AccountPostCountStatUpdate.php b/app/Console/Commands/AccountPostCountStatUpdate.php new file mode 100644 index 000000000..6d5ba00a6 --- /dev/null +++ b/app/Console/Commands/AccountPostCountStatUpdate.php @@ -0,0 +1,57 @@ +count(); + if($statusCount != $acct['statuses_count']) { + $profile = Profile::find($id); + if(!$profile) { + AccountStatService::removeFromPostCount($id); + continue; + } + $profile->status_count = $statusCount; + $profile->save(); + AccountService::del($id); + } + AccountStatService::removeFromPostCount($id); + } + return; + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index aadaa1f7a..7953ea783 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -38,7 +38,7 @@ class Kernel extends ConsoleKernel } if(config('import.instagram.enabled')) { - $schedule->command('app:transform-imports')->everyFourMinutes(); + $schedule->command('app:transform-imports')->everyTenMinutes(); $schedule->command('app:import-upload-garbage-collection')->hourlyAt(51); $schedule->command('app:import-remove-deleted-accounts')->hourlyAt(37); $schedule->command('app:import-upload-clean-storage')->twiceDailyAt(1, 13, 32); @@ -49,6 +49,7 @@ class Kernel extends ConsoleKernel } $schedule->command('app:notification-epoch-update')->weeklyOn(1, '2:21'); $schedule->command('app:hashtag-cached-count-update')->hourlyAt(25); + $schedule->command('app:account-post-count-stat-update')->everySixHours(25); } /** diff --git a/app/Services/Account/AccountStatService.php b/app/Services/Account/AccountStatService.php new file mode 100644 index 000000000..0b5d45a3e --- /dev/null +++ b/app/Services/Account/AccountStatService.php @@ -0,0 +1,26 @@ +onQueue('low'); + AccountStatService::incrementPostCount($pid); if( $status->in_reply_to_id === null && in_array($status->type, ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])