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

Fix handling of duplicate pages in RDF harvester's gather_stage #261

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ckanext/dcat/harvesters/rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ def gather_stage(self, harvest_job):

log.debug('In DCATRDFHarvester gather_stage')

visited_urls = set()

rdf_format = None
if harvest_job.source.config:
rdf_format = json.loads(harvest_job.source.config).get("rdf_format")
Expand All @@ -160,7 +162,7 @@ def gather_stage(self, harvest_job):
last_content_hash = None
self._names_taken = []

while next_page_url:
while next_page_url and next_page_url not in visited_urls:
for harvester in p.PluginImplementations(IDCATRDFHarvester):
next_page_url, before_download_errors = harvester.before_download(next_page_url, harvest_job)

Expand Down Expand Up @@ -250,6 +252,9 @@ def gather_stage(self, harvest_job):
harvest_job)
return []

# Add the current URL to the visited set
visited_urls.add(next_page_url)

# get the next page
next_page_url = parser.next_page()

Expand Down