forked from mtusi2026/mtusi2026lab5
bug fix
This commit is contained in:
@@ -118,6 +118,17 @@ async def process_locked(store: PostgresStore, s3: S3Store, payload: dict, lease
|
||||
metadata.append({"name": name, "object_key": object_key, "content_type": content_type,
|
||||
"size_bytes": len(content), "width": width, "height": height,
|
||||
"sha256": sha256(content).hexdigest()})
|
||||
# Explicit, opt-in integration fault. Marker survives container restart,
|
||||
# so one crash exercises lease recovery without a permanent crash loop.
|
||||
if os.environ.get('WORKER_FAULT_AFTER_S3_PUT') == '1':
|
||||
marker = Path('/tmp/worker-fault-after-s3')
|
||||
try:
|
||||
with marker.open('x') as stream:
|
||||
stream.write(str(attachment_id))
|
||||
except FileExistsError:
|
||||
pass
|
||||
else:
|
||||
os._exit(70)
|
||||
committed = await store.complete_attachment_job(attachment_id, original_key, metadata, attachment['claim_time'])
|
||||
if committed:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user