From ec9ea33c87bb7b5aa38e4dc3d9561c9b7ceb3df2 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Fri, 12 Sep 2025 11:18:31 +0200 Subject: [PATCH 1/3] Backfill users --- app/Console/Commands/BackfillIdenticons.php | 9 +++++++-- app/Social/GithubUserApi.php | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/BackfillIdenticons.php b/app/Console/Commands/BackfillIdenticons.php index ed7709f65..d4c4eea48 100644 --- a/app/Console/Commands/BackfillIdenticons.php +++ b/app/Console/Commands/BackfillIdenticons.php @@ -27,13 +27,18 @@ class BackfillIdenticons extends Command */ public function handle() { + $i = 0; + User::whereNotNull('github_id') - ->chunk(100, function ($users) { + ->chunk(100, function ($users) use (&$i) { foreach ($users as $user) { UpdateUserIdenticonStatus::dispatch($user); + $i++; } - sleep(2); + $this->info('Dispatched job for '.$i.' users'); }); + + $this->info('Dispatched job for a total of '.$i.' users'); } } diff --git a/app/Social/GithubUserApi.php b/app/Social/GithubUserApi.php index 21cf9ee0e..66aec97a6 100644 --- a/app/Social/GithubUserApi.php +++ b/app/Social/GithubUserApi.php @@ -30,6 +30,6 @@ public function hasIdenticon(int|string $id): bool [$width, $height] = $info; - return ! ($width === 420 && $height === 420); + return $width === 420 && $height === 420; } } From f7c70655cbcc3f97d3e67a867732a1a1b89667b8 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Fri, 12 Sep 2025 11:19:33 +0200 Subject: [PATCH 2/3] wip --- app/Console/Commands/BackfillIdenticons.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Console/Commands/BackfillIdenticons.php b/app/Console/Commands/BackfillIdenticons.php index d4c4eea48..956a837e4 100644 --- a/app/Console/Commands/BackfillIdenticons.php +++ b/app/Console/Commands/BackfillIdenticons.php @@ -33,6 +33,7 @@ public function handle() ->chunk(100, function ($users) use (&$i) { foreach ($users as $user) { UpdateUserIdenticonStatus::dispatch($user); + $i++; } From e0b1486086deed5e08c7f0ecffdf6a6f61778b9b Mon Sep 17 00:00:00 2001 From: driesvints <594614+driesvints@users.noreply.github.com> Date: Fri, 12 Sep 2025 09:22:22 +0000 Subject: [PATCH 3/3] Fix code styling --- app/Console/Commands/BackfillIdenticons.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/BackfillIdenticons.php b/app/Console/Commands/BackfillIdenticons.php index 956a837e4..386ee29da 100644 --- a/app/Console/Commands/BackfillIdenticons.php +++ b/app/Console/Commands/BackfillIdenticons.php @@ -27,13 +27,13 @@ class BackfillIdenticons extends Command */ public function handle() { - $i = 0; + $i = 0; User::whereNotNull('github_id') ->chunk(100, function ($users) use (&$i) { foreach ($users as $user) { UpdateUserIdenticonStatus::dispatch($user); - + $i++; }