Discovery for a sitemap-backed source (discovery.source: sitemap) re-fetches every sitemap document from scratch on each discover <site> invocation — there is no caching keyed by discovery.cache_ttl_hours, even though docs/specs/crawler-improvements.md's example configuration and "Scale and timeline" section call this out explicitly: migri.fi and dvv.fi's sitemap index alone costs ~2.4–2.5 hours to enumerate at their mandated 5s Crawl-delay, and that cost "should be paid roughly once a day at most per source, not on every run."
Discovered while auditing #74's Phase 1 implementation before building Phase 2 rendering (#75) on top of it.
Scope
- Add a
discovery.cache_ttl_hours field to DiscoveryConfig (crawler/tapio_crawler/config/config_models.py), matching the spec's example config.
- Cache the sitemap fetch/parse result (
crawler/tapio_crawler/discovery/sitemap.py) for that TTL, so a discover run within the window reuses the manifest's existing discovery state instead of re-enumerating every child sitemap.
- A run past the TTL performs a full re-fetch as today.
Acceptance criteria
Discovery for a sitemap-backed source (
discovery.source: sitemap) re-fetches every sitemap document from scratch on eachdiscover <site>invocation — there is no caching keyed bydiscovery.cache_ttl_hours, even though docs/specs/crawler-improvements.md's example configuration and "Scale and timeline" section call this out explicitly: migri.fi and dvv.fi's sitemap index alone costs ~2.4–2.5 hours to enumerate at their mandated 5sCrawl-delay, and that cost "should be paid roughly once a day at most per source, not on every run."Discovered while auditing #74's Phase 1 implementation before building Phase 2 rendering (#75) on top of it.
Scope
discovery.cache_ttl_hoursfield toDiscoveryConfig(crawler/tapio_crawler/config/config_models.py), matching the spec's example config.crawler/tapio_crawler/discovery/sitemap.py) for that TTL, so adiscoverrun within the window reuses the manifest's existing discovery state instead of re-enumerating every child sitemap.Acceptance criteria
cache_ttl_hoursago, whendiscoverruns again, then no sitemap or child-sitemap HTTP requests are made.discoverruns, then it re-fetches as it does today.