Calculate Storage usage on node creation [ENG-2402]#9548
Open
corbinSanders wants to merge 3 commits intoCenterForOpenScience:developfrom
Open
Calculate Storage usage on node creation [ENG-2402]#9548corbinSanders wants to merge 3 commits intoCenterForOpenScience:developfrom
corbinSanders wants to merge 3 commits intoCenterForOpenScience:developfrom
Conversation
added 2 commits
November 23, 2020 12:57
Johnetordoff
reviewed
Dec 3, 2020
Contributor
Johnetordoff
left a comment
There was a problem hiding this comment.
Looks pretty good, just have one question.
| addon.after_fork(original, forked, user) | ||
|
|
||
| forked.save() | ||
| update_storage_usage_cache(forked.id, forked._id) # Files were copied in the addons. Need to update storage usage |
Contributor
There was a problem hiding this comment.
If the cache is updating on first save why is this necessary? Shouldn't it update the cache on the previous line?
Contributor
Author
There was a problem hiding this comment.
This isn't the first save. L1598 is the first save.
Contributor
There was a problem hiding this comment.
Oh I see now, the hooks obviously aren't firing here, because it's just metadata.
| 'contentType': 'img/png' | ||
| }).save() | ||
|
|
||
| update_storage_usage(self.node) |
Contributor
There was a problem hiding this comment.
nit: I'd move these into create version just to cut down on the number of new lines.
…esn't cause mayhem.
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.
Purpose
We need to initialize storage usage on node creation. Whether this is a new node or a fork.
Changes
Adding update storage usage cache to save and forking methods. Adding tests
QA Notes
Please make verification statements inspired by your code and what your code touches.
What are the areas of risk?
Any concerns/considerations/questions that development raised? N/A
Documentation
N/A
Side Effects
Shouldn't be.
Ticket
https://openscience.atlassian.net/browse/ENG-2402