From 8c41a5dead47f2d0a79850e61e10bd14e1d26b31 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Mon, 6 Apr 2026 11:24:29 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20CancelledError/Exception=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=EC=97=90=EB=8F=84=20DB=20log=5Fcompletion=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit task.cancel()로 인한 CancelledError는 streaming loop 바깥에서 잡히므로 별도 log_completion 필요 Co-Authored-By: Claude Opus 4.6 (1M context) --- nanoclaude/services/worker.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nanoclaude/services/worker.py b/nanoclaude/services/worker.py index 329b481..19aa1ce 100644 --- a/nanoclaude/services/worker.py +++ b/nanoclaude/services/worker.py @@ -83,9 +83,17 @@ async def run(job: Job) -> None: except asyncio.CancelledError: job_manager.set_status(job.id, JobStatus.cancelled) await state_stream.push(job.id, "error", {"message": "작업이 취소되었습니다."}) + try: + await log_completion(job.id, "cancelled", 0, (time() - start_time) * 1000, time()) + except Exception: + pass except Exception: logger.exception("Worker failed for job %s", job.id) job_manager.set_status(job.id, JobStatus.failed) await state_stream.push(job.id, "error", {"message": "내부 오류가 발생했습니다."}) + try: + await log_completion(job.id, "failed", 0, (time() - start_time) * 1000, time()) + except Exception: + pass finally: await state_stream.push_done(job.id)