Skip to content

Commit

Permalink
env: maintain tracked page identifier cache between builds
Browse files Browse the repository at this point in the history
When a cache is kept for tracking previously published pages and their
identifiers, if a processing event results in pages not needing to be
updated, unchanged pages can cause their page identifiers to be removed
from the active list. This can result in a following pass to cleanup
legacy-flagged pages for pages that are still considered unchanged.

The cache implementation should be maintaining the assumed cached
identifier for pages if they remain changed for a run. Updating the
implementation to always populate the cached page identifiers before
replacing them with new active page identifiers (if any).

Signed-off-by: James Knight <[email protected]>
  • Loading branch information
jdknight committed Jan 30, 2025
1 parent 568064a commit 0dff978
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sphinxcontrib/confluencebuilder/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ def save_cache(self):
new_dochashs = dict(self._cached_dochash)
new_dochashs.update(self._active_dochash)

new_pids = dict(self._cached_pids)
new_pids.update(self._active_pids)

try:
with self._cache_cfg_file.open('w', encoding='utf-8') as f:
json.dump(new_cfg, f)
Expand All @@ -224,6 +227,6 @@ def save_cache(self):

try:
with self._cache_publish_file.open('w', encoding='utf-8') as f:
json.dump(self._active_pids, f)
json.dump(new_pids, f)
except OSError as e:
self.builder.warn('failed to save cache (pids): ' + e)

0 comments on commit 0dff978

Please sign in to comment.