fix: fix race condition where library is not in the store yet#826
Open
marslanabdulrauf wants to merge 4 commits into
Open
fix: fix race condition where library is not in the store yet#826marslanabdulrauf wants to merge 4 commits into
marslanabdulrauf wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the robustness of the ol_openedx_git_auto_export plugin when exporting newly-created courses/libraries to GitHub by handling “content not found (yet)” scenarios and deferring certain Celery dispatches until after DB commit, reducing transaction-timing races.
Changes:
- Introduces
ContentNotFoundErrorand updatesget_content_infoto raise it when courses/libraries can’t be found (including handlingContentLibraryNotFoundfrom the v2 libraries API). - Updates Celery tasks to treat missing content as a non-fatal/expected condition (logging and skipping/returning cleanly).
- Defers the library v2 “create repo + export” task dispatch using
transaction.on_commit(...)to avoid running before the creating transaction commits.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/ol_openedx_git_auto_export/ol_openedx_git_auto_export/utils.py |
Raises a plugin-specific not-found exception for v1/v2 library and course lookups. |
src/ol_openedx_git_auto_export/ol_openedx_git_auto_export/tasks.py |
Handles ContentNotFoundError in async tasks; adjusts Studio URL path composition for repo description. |
src/ol_openedx_git_auto_export/ol_openedx_git_auto_export/signals.py |
Uses transaction.on_commit for v2 library creation task dispatch to prevent pre-commit races. |
src/ol_openedx_git_auto_export/ol_openedx_git_auto_export/exceptions.py |
Adds the new ContentNotFoundError exception type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
@marslanabdulrauf is this ready for review? Could you please add the |
arslanashraf7
approved these changes
Jul 21, 2026
arslanashraf7
left a comment
Contributor
There was a problem hiding this comment.
LGTM with a small comment 👍
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.
What are the relevant tickets?
https://github.com/mitodl/hq/issues/12267
Description (What does it do?)
This pull request improves the reliability of exporting courses and libraries to GitHub by introducing better error handling for cases where content is not yet available in the database due to transaction timing. It adds a custom exception, ensures Celery tasks are dispatched only after database commits, and updates error handling in utility and task functions.
How can this be tested?