-
Notifications
You must be signed in to change notification settings - Fork 101
Open
Description
Describe the bug
FetcherBase.get_raw() in trestle/core/remote/cache.py performs a duplicate file read on failure.
When file_utils.load_file(self._cached_object_path) raises, the code immediately retries the exact same call in the except block without changing path, state, or parser. This causes redundant work and duplicate failure path execution.
To Reproduce
Steps to reproduce the behavior:
- Create a
LocalFetcherwith any readable cache file path. - Monkeypatch
trestle.common.file_utils.load_fileto always raise an exception. - Call
fetcher.get_raw(). - Count/inspect calls to
load_file. - See that
load_fileis called twice for a singleget_raw()invocation before raisingTrestleError.
Expected behavior
If load_file fails once, get_raw() should raise a single wrapped TrestleError without retrying the exact same read operation.
Screenshots / Logs.
Runtime verification output from local check (call counter):
2
This confirms duplicate invocation of load_file in the failure path.
Environment
- OS: Linux 6.8.0-101-generic
- Python version: 3.10.12
- Installed packages: local editable install via
pip install -e ".[dev]", project setup withmake develop
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
New