Avoid rewriting warm extraction cache
This commit is contained in:
parent
4a8980110d
commit
9fcafc290c
2 changed files with 21 additions and 18 deletions
|
|
@ -483,14 +483,7 @@ class AdapterProject:
|
|||
if source.source_id in invalidated:
|
||||
contribution = loader.extract_source(source)
|
||||
reparsed.append(source.source_id)
|
||||
else:
|
||||
record = cached[source.source_id]
|
||||
contribution = source_projection(record.payload)
|
||||
hits.append(source.source_id)
|
||||
validate_source_projection(source, contribution)
|
||||
contributions.append(contribution)
|
||||
cache_records.append(
|
||||
CachedSource(
|
||||
cache_record = CachedSource(
|
||||
source_id=source.source_id,
|
||||
source_path=source.source_path,
|
||||
fingerprint=source.fingerprint,
|
||||
|
|
@ -498,7 +491,13 @@ class AdapterProject:
|
|||
dependencies=source.dependencies,
|
||||
payload=source_payload(contribution),
|
||||
)
|
||||
)
|
||||
else:
|
||||
cache_record = cached[source.source_id]
|
||||
contribution = source_projection(cache_record.payload)
|
||||
hits.append(source.source_id)
|
||||
validate_source_projection(source, contribution)
|
||||
contributions.append(contribution)
|
||||
cache_records.append(cache_record)
|
||||
projection = AdapterProjection(
|
||||
project_id=manifest.project_id,
|
||||
title=manifest.title,
|
||||
|
|
@ -542,15 +541,16 @@ class AdapterProject:
|
|||
raise DocForgeError(
|
||||
"source_changed", "Adapter sources changed during incremental extraction"
|
||||
)
|
||||
write_extraction_cache(
|
||||
self._cache_path,
|
||||
ExtractionCache(
|
||||
project_id=manifest.project_id,
|
||||
adapter_id=manifest.adapter_id,
|
||||
adapter_version=manifest.adapter_version,
|
||||
sources=tuple(cache_records),
|
||||
),
|
||||
)
|
||||
if cache is None or invalidated or deleted:
|
||||
write_extraction_cache(
|
||||
self._cache_path,
|
||||
ExtractionCache(
|
||||
project_id=manifest.project_id,
|
||||
adapter_id=manifest.adapter_id,
|
||||
adapter_version=manifest.adapter_version,
|
||||
sources=tuple(cache_records),
|
||||
),
|
||||
)
|
||||
self._last_logic = logic_projections
|
||||
self._last_build_report = {
|
||||
"mode": "incremental",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue