Merge pull request #3717 from pixelfed/staging

Update command
This commit is contained in:
daniel 2022-10-31 02:18:50 -06:00 committed by GitHub
commit 2bb27229f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,7 @@ use App\Profile;
use App\User; use App\User;
use App\Instance; use App\Instance;
use App\Util\ActivityPub\Helpers; use App\Util\ActivityPub\Helpers;
use Symfony\Component\HttpKernel\Exception\HttpException;
class SendUpdateActor extends Command class SendUpdateActor extends Command
{ {
@ -75,15 +76,18 @@ class SendUpdateActor extends Command
$this->info('Found sharedInbox: ' . $url); $this->info('Found sharedInbox: ' . $url);
$bar = $this->output->createProgressBar($totalUserCount); $bar = $this->output->createProgressBar($totalUserCount);
$bar->start(); $bar->start();
User::chunk(50, function($users) use($bar, $url) { User::whereNull('status')->chunk(50, function($users) use($bar, $url) {
foreach($users as $user) { foreach($users as $user) {
$profile = Profile::find($user->profile_id); $profile = Profile::find($user->profile_id);
if(!$profile) { if(!$profile) {
continue; continue;
} }
$body = $this->updateObject($profile); $body = $this->updateObject($profile);
try {
Helpers::sendSignedObject($profile, $url, $body); Helpers::sendSignedObject($profile, $url, $body);
usleep(500); } catch (HttpException $e) {
continue;
}
$bar->advance(); $bar->advance();
} }
}); });