Skip to content

Commit 838c28d

Browse files
committed
fix: compute hashes synchronuously
1 parent fe3c8c8 commit 838c28d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/snakemake_storage_plugin_cached_http/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,12 +455,13 @@ async def verify_checksum(self, path: Path) -> None:
455455

456456
digest, checksum_expected = checksum.split(":", maxsplit=1)
457457

458-
# Compute checksum asynchronously (hashlib releases GIL)
459-
def compute_hash(digest: str = digest):
458+
def compute_hash(path: Path = path, digest: str = digest):
460459
with open(path, "rb") as f:
461460
return hashlib.file_digest(f, digest).hexdigest().lower()
462461

463-
checksum_observed = await asyncio.to_thread(compute_hash)
462+
# Compute checksum asynchronously (hashlib releases GIL)
463+
# checksum_observed = await asyncio.to_thread(compute_hash)
464+
checksum_observed = compute_hash(path, digest)
464465

465466
if checksum_expected != checksum_observed:
466467
raise WrongChecksum(observed=checksum_observed, expected=checksum_expected)

0 commit comments

Comments
 (0)