wp-cli / media-command

Imports files as attachments, regenerates thumbnails, or lists registered image sizes.
MIT License
44 stars 41 forks source link

Optimize memory consumption of querying attachments #188

Closed oxyc closed 6 months ago

oxyc commented 7 months ago

See #134

danielbachhuber commented 6 months ago

@oxyc Just to confirm, this improved memory management in your testing?

oxyc commented 6 months ago

I ran this patch successfully on a site with 25k images but that's quite low. However I just started the regeneration task on a site with 550k images and it will take a few days to complete before I can confirm it conclusively.

What I do know that before this patch, the get_images() query ran out of memory, which this patch fixed. I'll report back when the regenerate task finishes so I can confirm there are no memory leaks before closing #134 as fixed.

danielbachhuber commented 6 months ago

I'll report back when the regenerate task finishes so I can confirm there are no memory leaks before closing #134 as fixed.

Sounds great, thanks!

oxyc commented 6 months ago

It's been running for 3 days (still a long way to go) now so pretty confident there are no memory leaks in the loop.

danielbachhuber commented 6 months ago

@oxyc Awesome — thanks for reporting back!