-
Notifications
You must be signed in to change notification settings - Fork 0
Add error handling and basic tracking to abl #13
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
base: main
Are you sure you want to change the base?
Conversation
The idea is that we will use partial_data to determine if there was an error. If there was an error, we can cache less greedily.
|
The ABL keeps two versions when someone adds a new version: the version that is currently on REX (if there is one), and the new version they add. Edit: It already does this. |
lib/openstax/content/abl.rb
Outdated
| hash[page.uuid] ||= [] | ||
| hash[page.uuid] << { book: book.slug, page: page.slug } | ||
| end | ||
| rescue StandardError => exception |
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.
Hmm the issue is that this rescue will prevent the rescue in https://github.com/openstax/content-ruby/blob/main/lib/openstax/content/abl.rb#L57 from triggering, so we'll lose the behavior of trying old archive versions.
Maybe this logic has to replace the raise exception in https://github.com/openstax/content-ruby/blob/main/lib/openstax/content/abl.rb#L58 and https://github.com/openstax/content-ruby/blob/main/lib/openstax/content/abl.rb#L66 instead?
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.
Oh, you're right. I think I got in too big of a hurry on this one. I will fix it.
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.
@Dantemss I moved the error handling into each_book_with_previous_archive_version_fallback and changed it so that it tries with the newest archive version each time, and walks backwards up to max_attempts for each book.
Before it would reuse the same previous_archive for subsequent books, and only fail up to max_attempts for all books.
…eful degradation The changes fix a critical bug and significantly improve error handling. Key improvements: 1. Each book now gets its own previous_version and previous_archive instead of reusing the first failing book's archive for all subsequent failures 2. Replace complex batch retry pattern with straightforward per-book retry loop 3. New allow_partial_data parameter allows processing to continue when books fail, logging warnings instead of raising exceptions 4. Remove duplicate try/catch from slugs_by_page_uuid, consolidate in each_book_with_previous_archive_version_fallback 5. Add proper test setup with mocked books to verify graceful degradation and partial data handling
https://openstax.atlassian.net/browse/CORE-1521
The idea is that we will use
partial_datato determine if there was an error. If there was an error, we can cache less greedily.I tried to do this in a way that wouldn't break things that do not care about partial data. It's maybe a little hacky...
Next I plan to update
content.rbin exercises so that it sets the cache expiration to 30 minutes ifpartial_dataistrue.