Skip to content

Commit

Permalink
Only do one stat() for packages when sync-packages is on in verificat…
Browse files Browse the repository at this point in the history
…ion step 3

Related: #4
  • Loading branch information
taoky committed Aug 27, 2024
1 parent f4927fd commit d64ea61
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions shadowmire.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,12 +556,14 @@ def check_and_update(
should_update = False
for href, size in hrefsize_json:
dest = Path(normpath(package_simple_path / href))
if not dest.exists():
try:
dest_stat = dest.stat()
except FileNotFoundError:
logger.info("add %s as it's missing packages", package_name)
should_update = True
break
if compare_size and size != -1:
dest_size = dest.stat().st_size
dest_size = dest_stat.st_size
if dest_size != size:
logger.info(
"add %s as its local size %s != %s",
Expand Down

0 comments on commit d64ea61

Please sign in to comment.