Skip to content

Commit

Permalink
details polishing
Browse files Browse the repository at this point in the history
grammar fix, less shadow
  • Loading branch information
Fallen-Breath committed Jan 4, 2024
1 parent af5f2d5 commit 79ddade
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions prime_backup/action/validate_blobs_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ def validate_one_blob(blob: BlobInfo):
hash_to_blobs[blob.hash] = blob

with FailFastThreadPool('validator') as pool:
for blob in blobs:
for b in blobs:
if self.is_interrupted.is_set():
break
result.validated += 1
pool.submit(validate_one_blob, blob)
pool.submit(validate_one_blob, b)

orphan_hashes = set(session.filtered_orphan_blob_hashes(list(hash_to_blobs.keys())))
for h, blob in hash_to_blobs.items():
for h, b in hash_to_blobs.items():
if h in orphan_hashes:
result.orphan.append(BadBlobItem(blob, f'orphan blob with 0 associated file, hash {h}'))
result.orphan.append(BadBlobItem(b, f'orphan blob with 0 associated file, hash {h}'))
else:
result.ok += 1

Expand Down
2 changes: 1 addition & 1 deletion prime_backup/utils/thread_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class FailFastThreadPool(ThreadPoolExecutor):
"""
A thread pool that:
- makes exception raise as soon as possible
- no more tasks will be executed after the exception raises
- no more task will be submitted after an exception raises
"""
def __init__(self, name: str):
from prime_backup.config.config import Config
Expand Down

0 comments on commit 79ddade

Please sign in to comment.