| ... | @@ -89,7 +89,6 @@ class Mirror: | ... | @@ -89,7 +89,6 @@ class Mirror: |
| 89 | def __init__(self, root): | 89 | def __init__(self, root): |
| 90 | self.root = Path(root) | 90 | self.root = Path(root) |
| 91 | self.root.mkdir(parents=True, exist_ok=True) | 91 | self.root.mkdir(parents=True, exist_ok=True) |
| 92 | self.locks = self.root / '.mirror-locks' | | |
| 93 | self.slots = threading.BoundedSemaphore(4) | 92 | self.slots = threading.BoundedSemaphore(4) |
| 94 | self.refresh_lock = threading.Lock() | 93 | self.refresh_lock = threading.Lock() |
| 95 | | 94 | |
| ... | @@ -110,8 +109,9 @@ class Mirror: | ... | @@ -110,8 +109,9 @@ class Mirror: |
| 110 | try: | 109 | try: |
| 111 | if shutil.disk_usage(self.root).free < 16 * 1024**3: | 110 | if shutil.disk_usage(self.root).free < 16 * 1024**3: |
| 112 | raise Unavailable('mirror free-space reserve reached') | 111 | raise Unavailable('mirror free-space reserve reached') |
| 113 | self.locks.mkdir(exist_ok=True) | 112 | locks = self.root / '.mirror-locks' |
| 114 | with (self.locks / artifact_name).open('a') as lock: | 113 | locks.mkdir(exist_ok=True) |
| | 114 | with (locks / artifact_name).open('a') as lock: |
| 115 | fcntl.flock(lock, fcntl.LOCK_EX) | 115 | fcntl.flock(lock, fcntl.LOCK_EX) |
| 116 | if target.is_file(): | 116 | if target.is_file(): |
| 117 | return target | 117 | return target |