ckan / ckanext-deadoralive

A CKAN extension for the Dead or Alive link checker service
GNU Affero General Public License v3.0
6 stars 8 forks source link

Add fast mode support #2

Open seanh opened 10 years ago

seanh commented 10 years ago

Currently the link checker has to make two requests to CKAN for each link that it checks:

  1. Link checker posts to get_resource_ids_to_check and gets a list of resources to check. Iterates over them and for each:
  2. Link checker posts to resource_show to get the url of the resource
  3. Checks the url
  4. Posts to save_link_checker_result.

I think this is fine and appropriate for the 90% use-case: the link checker is running as a periodic background task, slowly checking links.

But there are some use-cases where you might want to support checking a lot of links as fast as possible:

A faster protocol would be:

  1. CKAN returns the URLs along with the resource IDs in the first place, so the link checker doesn't need to call resource_show for each. Calling resource_show right before checking each link means it gets the resource's current URL (may have changed) so is more accurate, but slower.
  2. The link checker posts all the results back to CKAN at once, instead of one post per result.