Redstone catalogue: each shard writes its own schematic part file

CI runs the three shards at once on an empty .local/lra-catalog: two of them
downloaded the same schematic into one `.part` name and one rename found it
gone. The part file now carries the process id.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Horizon agentandClaude Opus 5.5 committed 2026-11-05 22:58:28 +01:00
1 parent 4d4872cedd
commit 043705f347
1 file changed
+4 -2
+4 -2
View File
@@ -71,8 +71,10 @@ def fetch_schematics(entries):
request = urllib.request.Request(url, headers={'User-Agent': 'horizon/0.1'})
with urllib.request.urlopen(request, timeout=120) as response:
data = response.read()
path.with_suffix('.part').write_bytes(data)
path.with_suffix('.part').replace(path)
# The shards download into the same folder at once: each writes its own part file.
part = path.with_name(f'{path.name}.{os.getpid()}.part')
part.write_bytes(data)
part.replace(path)
sums[rel] = lab.digest(path, 'sha256')
listing = ''.join(f'{rel} {sums[rel]}\n' for rel in sorted(sums))
combined = hashlib.sha256(listing.encode()).hexdigest()