FIX: Improve downsize_uploads (PR #8409)

  • Actually remove original large-sized images
  • Don’t save processed files if their size increased
  • Prevent inconsistent state


You’ve signed the CLA, CvX. Thank you! This pull request is ready for review.

You don’t actually need that delta variable :wink:

return if before < upload.filesize


return if upload.filesize > before

Are these the only ones where we use an upload_id? What about some of the uploads settings? What about the user profiles?

Ah, yes, that was a leftover from a log-everything version :wink:

Those were taken from Upload’s after_destroy That probably should be updated as well.

Yeah, have a look at this query I think it’s the most up to date.

can you confirm we have indexes on all these tables (especially user avatar / profile)

I would love to see this merged, all the fixes sound great!

@SamSaffron User and UserAvatar have the correct indexes. UserProfile needed an update ( Category, CustomEmoji, and ThemeField don’t have indexes on those columns - should I add them?

1 Like

I think we can live with just user and user avatar and user profile for now, people are only going to rarely run this script so it is not a huge deal if it takes a bit longer