Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleartokens management command could have some performance improvements #651

Closed
jarussi-luizalabs opened this issue Oct 10, 2018 · 2 comments · Fixed by #969
Closed

cleartokens management command could have some performance improvements #651

jarussi-luizalabs opened this issue Oct 10, 2018 · 2 comments · Fixed by #969

Comments

@jarussi-luizalabs
Copy link

I'm using the cleartokens command to clear the expired tokens from my MySQL database and try to improve performance. However, we got to a point where we have a lot of tokens in our database (~300 MM) because of a bug in another application.

The command no longer workers because the delete() method from Django tries to load the entire object list to the python memory. The task will make the machine CPU goes to 100% and won't be able to delete anything.

I think we should have some alternatives to clear the tokens. Maybe some kind of pagination so it would delete X tokens at a time or maybe using the _raw_delete() method from Django ORM.

Is that an acceptable resolution for the problem? I can try and work in a PR to address this issue.

@isantolin
Copy link
Contributor

@jarussi-luizalabs I think it´s a good feature a expired token "pruning" by date. Currently i working on it. I hope see my work PR merged.

Obg.

@MattBlack85 MattBlack85 added this to the 1.4.0 milestone Oct 24, 2020
@n2ygk n2ygk removed this from the 1.5.0 milestone Mar 12, 2021
@auvipy
Copy link
Contributor

auvipy commented Oct 19, 2021

can you both check the PR

@n2ygk n2ygk closed this as completed in #969 Jan 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants