Skip to content

Commit 3c0af3a

Browse files
committed
fix asset/font sync
1 parent 3935289 commit 3c0af3a

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

backend/app/models/assets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async def upload_font_assets(db: Session, redis: Redis, frame: Frame, assets_pat
6262
remote_fonts = {a["path"]: int(a.get("size", 0)) for a in assets}
6363
else:
6464
command = f"find {assets_path}/fonts -type f -exec stat --format='%s %Y %n' {{}} +"
65-
status, stdout, _ = await run_command(db, redis, frame, command)
65+
status, stdout, _ = await run_command(db, redis, frame, command, log_output=False)
6666
stdout_lines = stdout.splitlines()
6767
remote_fonts = {}
6868
for line in stdout_lines:

backend/app/utils/remote_exec.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -438,16 +438,29 @@ async def _run_command_ssh(
438438
stderr_lines: list[str] = []
439439

440440
async def _read_stream(stream, dest: list[str], log_type: str) -> None:
441+
buf = ""
441442
while True:
442-
line = await stream.readline()
443-
if not line:
443+
chunk = await stream.read(32768)
444+
if not chunk:
444445
break
445-
if isinstance(line, (bytes, bytearray)):
446-
line = line.decode(errors="ignore")
447-
line = line.rstrip("\n")
448-
dest.append(line)
446+
if isinstance(chunk, (bytes, bytearray)):
447+
chunk = chunk.decode(errors="ignore")
448+
buf += chunk
449+
450+
# Emit complete lines; keep last partial in buf
451+
*lines, buf = buf.split("\n")
452+
for ln in lines:
453+
ln = ln.rstrip("\r")
454+
dest.append(ln) # <<< store it
455+
if log_output:
456+
await log(db, redis, frame.id, log_type, ln)
457+
458+
# Flush any leftover partial line at EOF
459+
if buf:
460+
ln = buf.rstrip("\r")
461+
dest.append(ln) # <<< store the final partial
449462
if log_output:
450-
await log(db, redis, frame.id, log_type, line)
463+
await log(db, redis, frame.id, log_type, ln)
451464

452465
stdout_task = asyncio.create_task(_read_stream(proc.stdout, stdout_lines, "stdout"))
453466
stderr_task = asyncio.create_task(_read_stream(proc.stderr, stderr_lines, "stderr"))

0 commit comments

Comments
 (0)