Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
thekavikumar committed Jan 26, 2024
1 parent d828a50 commit 078b297
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/training/wiki_training_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ def wiki_source_pages
# To handle more than 500 pages linked from the source page,
# we'll need to update this to use 'continue'.
query_params = { prop: 'links', titles: @wiki_base_page, pllimit: 500 }
links = []
finalLinks = []
begin
response = WikiApi.new(MetaWiki.new).query(query_params)
loop do
current_links = response.dig('pages', @wiki_base_page, 'links') || []
links.concat(current_links.map { |page| page['title'] })
finalLinks.concat(current_links.map { |page| page['title'] })

@continue = response['continue']&.fetch('plcontinue', 'done')
break if @continue == 'done'
Expand All @@ -111,7 +111,7 @@ def wiki_source_pages
rescue StandardError => e
raise InvalidWikiContentError, "could not get links from '#{@wiki_base_page}': #{e.message}"
end
links
finalLinks
end

def listed_wiki_source_pages
Expand Down

0 comments on commit 078b297

Please sign in to comment.