workers: don't re-upload handler-returned MinIO keys as local files
handle_process_compliance_service assumed handlers return local temp paths and re-uploaded each to MinIO. The MCS-150 handler uploads itself and returns the MinIO key, so the re-upload tried to read a nonexistent local file and logged a 'File not found' error after the order was already correctly held at the admin gate. Now we skip files that don't exist locally and keep the returned key as-is.
This commit is contained in:
parent
71404810c4
commit
4447905864
1 changed files with 7 additions and 0 deletions
|
|
@ -1265,6 +1265,13 @@ def handle_process_compliance_service(payload: dict) -> dict:
|
|||
for fp in file_paths:
|
||||
from pathlib import Path
|
||||
p = Path(fp)
|
||||
# Some handlers (e.g. MCS-150) upload to MinIO themselves and return the
|
||||
# resulting MinIO key rather than a local temp path. Those keys do not
|
||||
# exist on the local filesystem -- treat them as already-stored and keep
|
||||
# the key as-is instead of trying to re-upload a nonexistent local file.
|
||||
if not p.exists():
|
||||
minio_paths.append(fp)
|
||||
continue
|
||||
remote = f"compliance/{effective_order_number}/{p.name}"
|
||||
storage.upload(fp, remote)
|
||||
minio_paths.append(remote)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue