fix(file-caching): fixed cases when old cache was used before changes to operate on bytestrings

This commit is contained in:
RhodeCode Admin 2024-12-04 22:33:45 +01:00
parent 7c321dd71f
commit 3a41a8b915
11 changed files with 490 additions and 586 deletions

View file

@ -395,7 +395,7 @@ class RepoAppView(BaseAppView):
settings = settings_model.get_repo_settings_inherited()
return settings.get(settings_key, default)
def _get_readme_data(self, db_repo, renderer_type, commit_id=None, path="/"):
def _get_readme_data(self, db_repo, renderer_type, commit_id=None, path="/", nodes=None):
log.debug("Looking for README file at path %s", path)
if commit_id:
landing_commit_id = commit_id
@ -413,16 +413,14 @@ class RepoAppView(BaseAppView):
@region.conditional_cache_on_arguments(namespace=cache_namespace_uid)
def generate_repo_readme(
repo_id, _commit_id, _repo_name, _readme_search_path, _renderer_type
_repo_id, _commit_id, _repo_name, _readme_search_path, _renderer_type
):
readme_data = None
readme_filename = None
_readme_data = None
_readme_filename = None
commit = db_repo.get_commit(_commit_id)
log.debug("Searching for a README file at commit %s.", _commit_id)
readme_node = ReadmeFinder(_renderer_type).search(
commit, path=_readme_search_path
)
readme_node = ReadmeFinder(_renderer_type).search(commit, path=_readme_search_path, nodes=nodes)
if readme_node:
log.debug("Found README node: %s", readme_node)
@ -442,19 +440,19 @@ class RepoAppView(BaseAppView):
),
}
readme_data = self._render_readme_or_none(
_readme_data = self._render_readme_or_none(
commit, readme_node, relative_urls
)
readme_filename = readme_node.str_path
_readme_filename = readme_node.str_path
return readme_data, readme_filename
return _readme_data, _readme_filename
readme_data, readme_filename = generate_repo_readme(
db_repo.repo_id,
landing_commit_id,
db_repo.repo_name,
path,
renderer_type,
renderer_type
)
compute_time = time.time() - start