Use get_or_create_async_task for queuing user storage calc task#3067
Merged
bjester merged 1 commit intolearningequality:sprint-release-2021-03-29from Apr 5, 2021
Conversation
rtibbles
approved these changes
Apr 5, 2021
Member
rtibbles
left a comment
There was a problem hiding this comment.
Code changes look right, and the storage calculation was consistently rerun on upload and trash actions.
Codecov Report
@@ Coverage Diff @@
## sprint-release-2021-03-29 #3067 +/- ##
=============================================================
+ Coverage 85.93% 85.95% +0.01%
=============================================================
Files 304 304
Lines 16403 16403
=============================================================
+ Hits 14096 14099 +3
+ Misses 2307 2304 -3
Continue to review full report at Codecov.
|
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
We observed some slowdowns on
hotfixeslikely due to the user storage calculation query. We recently addedget_or_create_async_taskto only queue a task if there isn't one pending. The queuing of the user storage calculation task was using another approach, based off a cache value that may not work as expected (and observed odd behavior locally).Description of the change(s) you made
Updated the queuing of the user storage calculation task to use
get_or_create_asyn_task, and updated one instance that could call the function multiple times with the same user.Manual verification steps performed
Screenshots (if applicable)
Does this introduce any tech-debt items?
We should move
contentcuration.utils.user.calculate_user_storageto the User model, since we require a User object for queuing tasks.Reviewer guidance
How can a reviewer test these changes?
There isn't visibility into this particular task on the front-end, unfortunately.
Contributor's Checklist
Testing:
Reviewer's Checklist
This section is for reviewers to fill out.
yarnandpip)