It would be better, I think, to break the list of deletions into manageable chunks of 100 or so, rather than doing one at a time.
Something like this:
public function deleteMultiple($pids) { foreach (array_chunk($pids, 100) as $chunk) { $this->entityTypeManager->getStorage('path_alias')->delete($this->entityTypeManager->getStorage('path_alias')->loadMultiple($chunk)); } }
- Merge request !43Issue #3049145: Memory limit hit when deleting MANY aliases → (Merged) created by solideogloria
- Status changed to Needs review
over 1 year ago 3:06pm 21 March 2023 - First commit to issue fork.
-
Berdir →
committed e53edddf on 8.x-1.x authored by
solideogloria →
Issue #3049145: Memory limit hit when deleting MANY aliases
-
Berdir →
committed e53edddf on 8.x-1.x authored by
solideogloria →
- Status changed to Fixed
4 months ago 9:52am 1 August 2024 - 🇨🇭Switzerland berdir Switzerland
Yes, a chunk based approach makes sense, merged.
Would have been a bit nicer to create a local $storage variable to make the line shorter and easier to read, but not a big deal.
Automatically closed - issue fixed for 2 weeks with no activity.