Skip to content

Commit

Permalink
chunk character filter updates
Browse files Browse the repository at this point in the history
  • Loading branch information
recursivetree committed Sep 6, 2024
1 parent 5db867a commit 2985b60
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Jobs/UpdateCharacterFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ public function tags()
*/
public function handle()
{
$characters = CharacterInfo::all();
foreach ($characters as $character){
event(new CharacterFilterDataUpdate($character));
}
// without chunking, we can run out of memory on large installs
CharacterInfo::chunk(200, function ($characters){
foreach ($characters as $character){
event(new CharacterFilterDataUpdate($character));
}
});
}
}

0 comments on commit 2985b60

Please sign in to comment.