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

Prevent index from being deleted when a exception occurs #75

Merged

Conversation

joeyjurjens
Copy link
Contributor

No description provided.

@@ -129,7 +129,9 @@ def reindex(self):

try:
yield self
finally:
except Exception: # pylint: disable=try-except-raise
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In stead of:

try:
    yield self
except Exception:
    raise
else:
    self.indexer.finish()

I think you can just write it like this:

yield self
self.indexer.finish()

But I think you have to consult with viggo why the finish was there in the finally block first.

Copy link
Contributor Author

@joeyjurjens joeyjurjens Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I think you have to consult with viggo why the finish was there in the finally block first.

  • I made this some time ago, but didn't think of errors when I made this. So the new logic is correct.

@specialunderwear specialunderwear merged commit 4b46d83 into django-oscar:master Nov 21, 2024
1 check passed
@joeyjurjens joeyjurjens deleted the do-not-remove-index-on-error branch November 21, 2024 07:52
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.

2 participants