Skip to content

Commit d84304d

Browse files
committed
load_or_install: trust load() result when no_cache is set
Devin Review caught that ``if loaded.is_valid and not no_cache:`` applied the caller's ``no_cache`` flag to the value we just got back from ``load()``. ``load()`` already honours the flag internally, so a valid result is fresh regardless — the ``and not no_cache`` guard was forcing a redundant ``install()`` whenever ``no_cache=True`` even though the binary already resolved. Drop the redundant condition.
1 parent c680d90 commit d84304d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

abxpkg/binary.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,9 @@ def load_or_install(
473473
)
474474
except BinaryLoadError:
475475
loaded = self
476-
if loaded.is_valid and not no_cache:
476+
# ``load()`` was already called with the caller's ``no_cache`` flag, so
477+
# a valid result is already fresh — trust it and skip ``install()``.
478+
if loaded.is_valid:
477479
return loaded
478480
return self.install(
479481
binproviders=binproviders,

0 commit comments

Comments
 (0)