fix: deduplicate GLB/USD generation with Redis locks + review fixes

- Add per-file Redis SET NX EX 1800 locks to generate_gltf_geometry_task
  and generate_usd_master_task — concurrent duplicates (e.g. double-click
  of bulk action buttons) now log a warning and return immediately instead
  of running two expensive OCC tessellation subprocesses on the same file
- Fix eng.dispose() called inside with Session() block in cache-hit path
  of both tasks — moved to after the with block exits (Tasks 3+4 from plan)
- Add cad.updated_at = datetime.utcnow() in save_manual_material_overrides
  (was missing vs parallel save_part_materials endpoint)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 13:50:05 +01:00
parent 409fb92899
commit 71e099305c
4 changed files with 545 additions and 410 deletions
+1
View File
@@ -535,6 +535,7 @@ async def save_manual_material_overrides(
cad = await _get_cad_file(id, db)
cad.manual_material_overrides = body.overrides
cad.updated_at = datetime.utcnow()
await db.commit()
await db.refresh(cad)
return ManualMaterialOverridesOut(