lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

[Bug]: Bulk-removing comments leads to timeout if there are many

Open bjoern-tantau opened this issue 1 year ago • 3 comments

Requirements

  • [X] Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support
  • [X] Did you check to see if this issue already exists?
  • [X] Is this only a single bug? Do not put multiple bugs in one issue.
  • [X] Do you agree to follow the rules in our Code of Conduct?
  • [X] Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.

Summary

When bulk-removing comments from a user who has lots of them it takes a long time and then times out. I guess it's trying to remove all of them in one go.

Screenshot_20240419-185303

Steps to Reproduce

  1. Start to ban a user with lots of content.
  2. Select "remove content"
  3. Send

Technical Details

Sorry, don't have access to the server at the moment.

Version

BE 0.19.3

Lemmy Instance URL

swg-empire.de

bjoern-tantau avatar Apr 19 '24 16:04 bjoern-tantau

This might also be partially Jerboa, Jerboa has a timeout of 20s. Not sure if the Server has a timeout but that also might be exceeded by this request regardless. Perhaps the server should queue this action?

MV-GH avatar Apr 20 '24 14:04 MV-GH

Yep, these longer actions could potentially be backgrounded... but I'd rather investigate which DB action in crates/api_common/src/utils.rs remove_user_data is taking so long.

dessalines avatar Apr 22 '24 15:04 dessalines

Its most likely purge_image_posts_for_person() which loops through a potentially very large list of posts, and makes HTTP calls to pictrs for each item. Similarly it loops through all communities where that user is top mod. Those and other for loops in utils.rs should be moved to background threads.

Nutomic avatar Sep 25 '24 10:09 Nutomic