fix: cancel된 job도 DB에 상태 기록

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-04-06 11:21:07 +09:00
parent e970ebdbea
commit 72c488d85d

View File

@@ -44,6 +44,11 @@ async def run(job: Job) -> None:
if job.status == JobStatus.cancelled:
logger.info("Job %s cancelled during streaming", job.id)
await state_stream.push(job.id, "error", {"message": "작업이 취소되었습니다."})
latency_ms = (time() - start_time) * 1000
try:
await log_completion(job.id, "cancelled", len("".join(collected)), latency_ms, time())
except Exception:
pass
return
collected.append(chunk)