File tree Expand file tree Collapse file tree 3 files changed +35808
-115720
lines changed Expand file tree Collapse file tree 3 files changed +35808
-115720
lines changed Original file line number Diff line number Diff line change 318318 roar
319319 roar-rails (>= 1 )
320320 uber
321- openstax_content (1.1 .0 )
321+ openstax_content (1.2 .0 )
322322 aws-sdk-s3
323323 faraday
324324 nokogiri
Original file line number Diff line number Diff line change @@ -6,19 +6,43 @@ def self.slugs_by_page_uuid
66 "slugs_by_page_uuid/#{ OpenStax ::Content ::Abl . new . digest } "
77 ) do
88 { } . tap do |hash |
9- OpenStax ::Content ::Abl . new . approved_books . each do |book |
10- begin
11- pages = book . all_pages
12- rescue StandardError => exception
13- # Sometimes books in the ABL fail to load
14- # Log it, but keep going
15- Rails . logger . error exception
16- else
17- pages . each do |page |
18- hash [ page . uuid ] ||= [ ]
19- hash [ page . uuid ] << { book : book . slug , page : page . slug }
9+ books = OpenStax ::Content ::Abl . new . approved_books
10+
11+ until books . empty?
12+ previous_version = nil
13+ previous_archive = nil
14+ retry_books = [ ]
15+
16+ books . each do |book |
17+ begin
18+ pages = book . all_pages
19+ rescue StandardError => exception
20+ # Sometimes books in the ABL fail to load
21+ # Retry with an earlier version of archive, if possible
22+ previous_version ||= book . archive . previous_version
23+
24+ if previous_version . nil?
25+ raise exception
26+ else
27+ previous_archive ||= OpenStax ::Content ::Archive . new version : previous_version
28+
29+ retry_books << OpenStax ::Content ::Book . new (
30+ archive : previous_archive ,
31+ uuid : book . uuid ,
32+ version : book . version ,
33+ slug : book . slug ,
34+ style : book . style
35+ )
36+ end
37+ else
38+ pages . each do |page |
39+ hash [ page . uuid ] ||= [ ]
40+ hash [ page . uuid ] << { book : book . slug , page : page . slug }
41+ end
2042 end
2143 end
44+
45+ books = retry_books
2246 end
2347 end
2448 end
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments