fix: purge all old staging path references — full code review cleanup
Bugs found and fixed: - converter.py: STAGING_IN.iterdir() → extract_base.iterdir() (checked wrong dir when source was in session subdir) - vm-bench.service: TMPDIR=/mnt/converter/in → /mnt/converter/tmp (old path poisoned all temp file writes) - backend/app.py: removed unused STAGING_IN constant - converter.py: removed unused STAGING_OUT constant - install.sh: removed creation of old /in and /out dirs
This commit is contained in:
parent
1b145adea7
commit
6617aca341
4 changed files with 2 additions and 6 deletions
|
|
@ -54,7 +54,6 @@ logger.info("Backend starting — log file: %s", LOG_DIR / "vm-bench-backend.log
|
|||
# ---------------------------------------------------------------------------
|
||||
# Constants
|
||||
# ---------------------------------------------------------------------------
|
||||
STAGING_IN = "/mnt/converter/in"
|
||||
API_PREFIX = "/api/v1"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ from typing import Optional
|
|||
|
||||
STAGING_ROOT = Path("/mnt/converter/tmp")
|
||||
STAGING_IN = STAGING_ROOT / "in"
|
||||
STAGING_OUT = STAGING_ROOT / "out"
|
||||
|
||||
logger = logging.getLogger("backend.converter")
|
||||
|
||||
|
|
@ -108,7 +107,7 @@ def extract_if_needed(filename: str) -> Path:
|
|||
raise RuntimeError(f"{tool} failed: {result.stderr.strip()[:500]}")
|
||||
|
||||
# Determine what was created
|
||||
after = set(STAGING_IN.iterdir())
|
||||
after = set(extract_base.iterdir())
|
||||
new_items = after - before
|
||||
|
||||
# If the archive had a single top-level directory matching the stem, use it
|
||||
|
|
|
|||
|
|
@ -58,8 +58,6 @@ echo "[1/6] Creating directory structure..."
|
|||
|
||||
for d in \
|
||||
"$CONVERTER_ROOT" \
|
||||
"$CONVERTER_ROOT/in" \
|
||||
"$CONVERTER_ROOT/out" \
|
||||
"$CONVERTER_ROOT/logs" \
|
||||
"$CONVERTER_ROOT/tmp" \
|
||||
"$CONVERTER_ROOT/backend" \
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ User=root
|
|||
WorkingDirectory=/mnt/converter/frontend
|
||||
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
Environment=BACKEND_URL=http://10.2.0.2:9000
|
||||
Environment=TMPDIR=/mnt/converter/in
|
||||
Environment=TMPDIR=/mnt/converter/tmp
|
||||
ExecStart=/usr/bin/python3 -m uvicorn app:app --host 0.0.0.0 --port 5000 --timeout-keep-alive 300
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
|
|
|||
Loading…
Reference in a new issue