fix: lock meta RMW and harden concurrent remix paths
CI / lint-and-test (pull_request) Failing after 9s
CI / lint-and-test (pull_request) Failing after 9s
Prevent worker/web clobbering of meta variants via flock and merge-by-id, make filter timeouts thread-local, harden job-id/stem sanitization, migrate TemplateResponse API, and remove the compare-bg experiment. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+11
-4
@@ -3,6 +3,7 @@ cached original + rembg output and user-chosen filters/blends/opacity."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
from dataclasses import dataclass
|
||||
|
||||
from . import pipeline
|
||||
@@ -52,8 +53,8 @@ def create_remix_variant(job_id: str, choice: RemixChoice) -> dict:
|
||||
"variants": [],
|
||||
}
|
||||
variant_stem = pipeline.resolve_source_stem(manifest, paths)
|
||||
manifest.setdefault("source_stem", variant_stem)
|
||||
variant_id = pipeline.next_variant_id(manifest)
|
||||
# Unique id avoids collisions when two remixes run in parallel.
|
||||
variant_id = f"v{uuid.uuid4().hex[:8]}"
|
||||
|
||||
entry = pipeline.compose_variant(
|
||||
paths,
|
||||
@@ -67,6 +68,12 @@ def create_remix_variant(job_id: str, choice: RemixChoice) -> dict:
|
||||
fg_mode=choice.fg_blend,
|
||||
opacity=choice.opacity,
|
||||
)
|
||||
manifest["variants"].append(entry)
|
||||
pipeline.write_manifest(paths, manifest)
|
||||
pipeline.append_manifest_variant(
|
||||
paths,
|
||||
entry,
|
||||
original_file=paths.original.name,
|
||||
rembg_file=paths.rembg.name,
|
||||
source_stem=variant_stem,
|
||||
created_at=manifest.get("created_at") if isinstance(manifest.get("created_at"), str) else None,
|
||||
)
|
||||
return entry
|
||||
|
||||
Reference in New Issue
Block a user