optimize garabge collection command#4808
Merged
bjester merged 4 commits intolearningequality:hotfixesfrom Nov 14, 2024
Merged
Conversation
ozer550
commented
Nov 8, 2024
| ContentNode.objects.values_list('id', 'main_tree__tree_id') | ||
| ) | ||
|
|
||
| logging.debug("Queries after creating channel tree ID map: %s", connection.queries) |
Member
Author
There was a problem hiding this comment.
We need settings.DEBUG = True to get the queries printed.
bjester
requested changes
Nov 12, 2024
Member
bjester
left a comment
There was a problem hiding this comment.
Sorry it seems there was some confusion with my last feedback. We should be able to use non_public_channels_sole_editor to iterate over its tree ID's, instead of looping over all channels
| # our garbage collection delete the nodes and underlying file. | ||
| channel_tree_id_map = dict( | ||
| Channel.objects.values_list('id', 'main_tree__tree_id') | ||
| ) |
Member
There was a problem hiding this comment.
Ah this is a lot of channels! I meant iterating over the tree_id using non_public_channels_sole_editor. This won't work well either
Member
Author
There was a problem hiding this comment.
oh yes, my apologies now I see it that was an unnecessary overhead!
This was referenced Nov 14, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restructure the way we run the query while deleting user_related data to stop the garbage_collection command from stalling.
Description of the change(s) you made
How can a reviewer test these changes?
Are there any risky areas that deserve extra testing?
References
closes #4780
Comments
We need to have the settings.DEBUG=True to log the queries.
Contributor's Checklist
PR process:
CHANGELOGlabel been added to this PR. Note: items with this label will be added to the CHANGELOG at a later timedocslabel has been added if this introduces a change that needs to be updated in the user docs?requirements.txtfiles also included in this PRStudio-specifc:
notranslateclass been added to elements that shouldn't be translated by Google Chrome's automatic translation feature (e.g. icons, user-generated text)pages,components, andlayoutsdirectories as described in the docsTesting:
Reviewer's Checklist
This section is for reviewers to fill out.
yarnandpip)