Skip to content
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

Handle CircularDependencyException at the topmost level of operation ordering #167

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alxbridge
Copy link

The previous fix for circular dependencies (#91) added handling to ImportPlanner such that a CircularDependencyException will be raised and "propagated back up the chain until we're back to a caller that can handle it gracefully".

However, as CircularDependencyException is only handled inside _add_to_operation_order(), this means that any exceptions which get raised above that method in the call stack - to the starting point in run() - don't get handled, and a 500 error returned on import.

As I understand it, if run has determined that the operations are satisfiable, that means there shouldn't be any hard dependencies between any of them at this level. On that assumption, I've added handling in this PR which catches any CircularDependencyExceptions in run() and retries adding them to the operation order, after running through the rest of the list.

This fixes the instance where I've seen this issue occur on a site. I'm happy to add tests to this PR to cover this case - but initially I'd appreciate a review that my assumptions and fix look correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant