-
Notifications
You must be signed in to change notification settings - Fork 18
feat: handle file content logic when creating next component version #248
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ff8f794
feat: handle file content logic when creating next component version
Ian2012 7226354
test: add tests for bytes content
Ian2012 cfe4984
refactor: add/delete assets in one shot in command
Ian2012 da5ecfc
chore: handle PR comments
Ian2012 d41cc64
test: ignore migrations from coverage report
Ian2012 c6bb9e8
test: ignore tests from coverage report
Ian2012 07b4d07
docs: update create next component version docstring
Ian2012 74ac2d9
docs: update create next component version docstring
Ian2012 d92e8e3
chore: bump version to v0.16.3
Ian2012 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,4 +2,4 @@ | |
| Open edX Learning ("Learning Core"). | ||
| """ | ||
|
|
||
| __version__ = "0.16.2" | ||
| __version__ = "0.16.3" | ||
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[non-blocking question] Since we're potentially doing multiple insert operations here, should this method wrap its contents in
with atomic():? We have a few other api methods that do.Would also be ok with updating the function docs to recommend wrapping the method call with
atomicif passing content bytes in, since that's what the ticket did.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, this was an oversight on my part in the review. Whenever possible, my intent was for these API functions to be atomic, so that we don't get inconsistent half-writes to the database. (Inconsistent half-writes to the file store are harder to guard against, but I feel better about that since they're idempotent inserts storing file data by hash–so "do it again" results in the same thing and hopefully the worst thing we do is write some unreferenced data.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ormsbee should we do a follow-up PR to wrap this function in a transaction?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The full API operation is wrapped in an atomic block:
https://github.com/openedx/openedx-learning/blob/main/openedx_learning/apps/authoring/components/api.py#L180-L182
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄 Ah, that makes sense. Thank you!