Skip to content
This repository has been archived by the owner on Nov 26, 2022. It is now read-only.

accounts with short delete_every but restrictive filters cause lots of refreshes #174

Closed
codl opened this issue Mar 11, 2019 · 1 comment · Fixed by #202
Closed

accounts with short delete_every but restrictive filters cause lots of refreshes #174

codl opened this issue Mar 11, 2019 · 1 comment · Fixed by #202
Assignees
Labels

Comments

@codl
Copy link
Owner

codl commented Mar 11, 2019

ive had the occasional complaint that forget was making a lot of requests and i couldnt say why but now i know

in delete_from_account, this query:

forget/tasks.py

Lines 231 to 238 in 41683fc

latest_n_posts = (Post.query.with_parent(account, 'posts').order_by(
db.desc(Post.created_at)).limit(account.policy_keep_latest)
.cte(name='latest'))
posts = (
Post.query.with_parent(account, 'posts')
.filter(Post.created_at + account.policy_keep_younger <= db.func.now())
.filter(~Post.id.in_(db.select((latest_n_posts.c.id, )))).order_by(
db.func.random()).limit(100).all())

does not use any of the filters, and every post that is returned from it is refreshed until one of them matches all the filters

if someone has restrictive filters like "delete media only" or "delete faves only" then this will likely get 100 posts that don't match, do 100 requests to refresh them, and fail to delete anything

@codl
Copy link
Owner Author

codl commented Mar 11, 2019

i really really wish mastodon had an endpoint for getting a lot of posts by id like twitter does

cough mastodon/mastodon#6136

@codl codl added the defect label Mar 11, 2019
@codl codl self-assigned this Mar 11, 2019
codl added a commit that referenced this issue May 11, 2019
until now, delete_from_account would only ignore posts that were too
young, but would fetch and refresh posts that didn't match
fave/media/DM policies. this was fine most of the time but would result
in a lot of refreshes if those policies were very restrictive. now these
policies are respected when selecting candidate posts for deletion

closes #174
@codl codl closed this as completed in #202 May 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant